mailing list of musl libc
 help / color / mirror / code / Atom feed
* clz instruction is unavailable for Thumb1
@ 2018-02-28  0:03 Zhao, Weiming
  2018-02-28  0:37 ` Andre McCurdy
  0 siblings, 1 reply; 8+ messages in thread
From: Zhao, Weiming @ 2018-02-28  0:03 UTC (permalink / raw)
  To: musl

In arch/arm/atomic_arch.h, it checks for __ARM_ARCH >= 5, which is not 
sufficient.

for example, for armv6-m, it only support Thumb1, which doesn't include clz.

Suggest to check if it's building for thumb1:

diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h
index c5c56f8..e3cb66a 100644
--- a/arch/arm/atomic_arch.h
+++ b/arch/arm/atomic_arch.h
@@ -82,7 +82,7 @@ static inline void a_crash()
                 : : : "memory");
  }

-#if __ARM_ARCH >= 5
+#if __ARM_ARCH >= 5 && !(defined(__thumb__) && !defined(__thumb2))



-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: clz instruction is unavailable for Thumb1
  2018-02-28  0:03 clz instruction is unavailable for Thumb1 Zhao, Weiming
@ 2018-02-28  0:37 ` Andre McCurdy
  2018-02-28  1:01   ` Rich Felker
  0 siblings, 1 reply; 8+ messages in thread
From: Andre McCurdy @ 2018-02-28  0:37 UTC (permalink / raw)
  To: musl

On Tue, Feb 27, 2018 at 4:03 PM, Zhao, Weiming <weimingz@codeaurora.org> wrote:
> In arch/arm/atomic_arch.h, it checks for __ARM_ARCH >= 5, which is not
> sufficient.
>
> for example, for armv6-m, it only support Thumb1, which doesn't include clz.
>
> Suggest to check if it's building for thumb1:

Musl does not currently support Thumb 1.

> diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h
> index c5c56f8..e3cb66a 100644
> --- a/arch/arm/atomic_arch.h
> +++ b/arch/arm/atomic_arch.h
> @@ -82,7 +82,7 @@ static inline void a_crash()
>                 : : : "memory");
>  }
>
> -#if __ARM_ARCH >= 5
> +#if __ARM_ARCH >= 5 && !(defined(__thumb__) && !defined(__thumb2))
>
>
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by
> The Linux Foundation
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: clz instruction is unavailable for Thumb1
  2018-02-28  0:37 ` Andre McCurdy
@ 2018-02-28  1:01   ` Rich Felker
  2018-02-28  1:26     ` Andre McCurdy
  2018-02-28  3:56     ` Khem Raj
  0 siblings, 2 replies; 8+ messages in thread
From: Rich Felker @ 2018-02-28  1:01 UTC (permalink / raw)
  To: musl

On Tue, Feb 27, 2018 at 04:37:15PM -0800, Andre McCurdy wrote:
> On Tue, Feb 27, 2018 at 4:03 PM, Zhao, Weiming <weimingz@codeaurora.org> wrote:
> > In arch/arm/atomic_arch.h, it checks for __ARM_ARCH >= 5, which is not
> > sufficient.
> >
> > for example, for armv6-m, it only support Thumb1, which doesn't include clz.
> >
> > Suggest to check if it's building for thumb1:
> 
> Musl does not currently support Thumb 1.

I forget what the situation with v6-m is, and whether/how it could be
supportable. Is it really thumb1 or some thumb2 subset that fills
deficiencies? My recollection was that thumb1 lacks atomics, barriers,
thread-pointer loading, and maybe even syscalls, and since the
kuser_helper addresses are arm addresses, you can't even use them to
get the missing functionality.

Rich


> > diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h
> > index c5c56f8..e3cb66a 100644
> > --- a/arch/arm/atomic_arch.h
> > +++ b/arch/arm/atomic_arch.h
> > @@ -82,7 +82,7 @@ static inline void a_crash()
> >                 : : : "memory");
> >  }
> >
> > -#if __ARM_ARCH >= 5
> > +#if __ARM_ARCH >= 5 && !(defined(__thumb__) && !defined(__thumb2))
> >
> >
> >
> > --
> > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by
> > The Linux Foundation
> >


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: clz instruction is unavailable for Thumb1
  2018-02-28  1:01   ` Rich Felker
@ 2018-02-28  1:26     ` Andre McCurdy
  2018-02-28  2:16       ` Rich Felker
  2018-02-28  3:56     ` Khem Raj
  1 sibling, 1 reply; 8+ messages in thread
From: Andre McCurdy @ 2018-02-28  1:26 UTC (permalink / raw)
  To: musl

On Tue, Feb 27, 2018 at 5:01 PM, Rich Felker <dalias@libc.org> wrote:
> On Tue, Feb 27, 2018 at 04:37:15PM -0800, Andre McCurdy wrote:
>> On Tue, Feb 27, 2018 at 4:03 PM, Zhao, Weiming <weimingz@codeaurora.org> wrote:
>> > In arch/arm/atomic_arch.h, it checks for __ARM_ARCH >= 5, which is not
>> > sufficient.
>> >
>> > for example, for armv6-m, it only support Thumb1, which doesn't include clz.
>> >
>> > Suggest to check if it's building for thumb1:
>>
>> Musl does not currently support Thumb 1.
>
> I forget what the situation with v6-m is, and whether/how it could be
> supportable. Is it really thumb1 or some thumb2 subset that fills
> deficiencies?

It's Thumb1 plus BL, DMB, DSB, ISB, MRS and MSR from Thumb2.

> My recollection was that thumb1 lacks atomics, barriers,
> thread-pointer loading, and maybe even syscalls, and since the
> kuser_helper addresses are arm addresses, you can't even use them to
> get the missing functionality.
>
> Rich
>
>
>> > diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h
>> > index c5c56f8..e3cb66a 100644
>> > --- a/arch/arm/atomic_arch.h
>> > +++ b/arch/arm/atomic_arch.h
>> > @@ -82,7 +82,7 @@ static inline void a_crash()
>> >                 : : : "memory");
>> >  }
>> >
>> > -#if __ARM_ARCH >= 5
>> > +#if __ARM_ARCH >= 5 && !(defined(__thumb__) && !defined(__thumb2))
>> >
>> >
>> >
>> > --
>> > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by
>> > The Linux Foundation
>> >


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: clz instruction is unavailable for Thumb1
  2018-02-28  1:26     ` Andre McCurdy
@ 2018-02-28  2:16       ` Rich Felker
  2018-02-28  3:00         ` Andre McCurdy
  0 siblings, 1 reply; 8+ messages in thread
From: Rich Felker @ 2018-02-28  2:16 UTC (permalink / raw)
  To: musl

On Tue, Feb 27, 2018 at 05:26:13PM -0800, Andre McCurdy wrote:
> On Tue, Feb 27, 2018 at 5:01 PM, Rich Felker <dalias@libc.org> wrote:
> > On Tue, Feb 27, 2018 at 04:37:15PM -0800, Andre McCurdy wrote:
> >> On Tue, Feb 27, 2018 at 4:03 PM, Zhao, Weiming <weimingz@codeaurora.org> wrote:
> >> > In arch/arm/atomic_arch.h, it checks for __ARM_ARCH >= 5, which is not
> >> > sufficient.
> >> >
> >> > for example, for armv6-m, it only support Thumb1, which doesn't include clz.
> >> >
> >> > Suggest to check if it's building for thumb1:
> >>
> >> Musl does not currently support Thumb 1.
> >
> > I forget what the situation with v6-m is, and whether/how it could be
> > supportable. Is it really thumb1 or some thumb2 subset that fills
> > deficiencies?
> 
> It's Thumb1 plus BL, DMB, DSB, ISB, MRS and MSR from Thumb2.

So that covers barrier but not atomics or thread pointer or syscalls,
right? I'm not seeing how arm with only thumb1 plus the above can be a
viable platform musl could run on, but maybe there are some kernel
mechanisms to help..?

Rich


> > My recollection was that thumb1 lacks atomics, barriers,
> > thread-pointer loading, and maybe even syscalls, and since the
> > kuser_helper addresses are arm addresses, you can't even use them to
> > get the missing functionality.
> >
> > Rich
> >
> >
> >> > diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h
> >> > index c5c56f8..e3cb66a 100644
> >> > --- a/arch/arm/atomic_arch.h
> >> > +++ b/arch/arm/atomic_arch.h
> >> > @@ -82,7 +82,7 @@ static inline void a_crash()
> >> >                 : : : "memory");
> >> >  }
> >> >
> >> > -#if __ARM_ARCH >= 5
> >> > +#if __ARM_ARCH >= 5 && !(defined(__thumb__) && !defined(__thumb2))
> >> >
> >> >
> >> >
> >> > --
> >> > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by
> >> > The Linux Foundation
> >> >


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: clz instruction is unavailable for Thumb1
  2018-02-28  2:16       ` Rich Felker
@ 2018-02-28  3:00         ` Andre McCurdy
  2018-02-28 10:43           ` Szabolcs Nagy
  0 siblings, 1 reply; 8+ messages in thread
From: Andre McCurdy @ 2018-02-28  3:00 UTC (permalink / raw)
  To: musl

On Tue, Feb 27, 2018 at 6:16 PM, Rich Felker <dalias@libc.org> wrote:
> On Tue, Feb 27, 2018 at 05:26:13PM -0800, Andre McCurdy wrote:
>> On Tue, Feb 27, 2018 at 5:01 PM, Rich Felker <dalias@libc.org> wrote:
>> > On Tue, Feb 27, 2018 at 04:37:15PM -0800, Andre McCurdy wrote:
>> >> On Tue, Feb 27, 2018 at 4:03 PM, Zhao, Weiming <weimingz@codeaurora.org> wrote:
>> >> > In arch/arm/atomic_arch.h, it checks for __ARM_ARCH >= 5, which is not
>> >> > sufficient.
>> >> >
>> >> > for example, for armv6-m, it only support Thumb1, which doesn't include clz.
>> >> >
>> >> > Suggest to check if it's building for thumb1:
>> >>
>> >> Musl does not currently support Thumb 1.
>> >
>> > I forget what the situation with v6-m is, and whether/how it could be
>> > supportable. Is it really thumb1 or some thumb2 subset that fills
>> > deficiencies?
>>
>> It's Thumb1 plus BL, DMB, DSB, ISB, MRS and MSR from Thumb2.
>
> So that covers barrier but not atomics or thread pointer or syscalls,
> right?

Thumb1 can make syscalls, but armv6-m has no atomics (the RTOS style
alternative being to disable interrupts around critical sections) and
no thread pointer (no coprocessors at all).

> I'm not seeing how arm with only thumb1 plus the above can be a
> viable platform musl could run on, but maybe there are some kernel
> mechanisms to help..?

I don't know if it's even possible to run a Linux kernel on these devices.

>> > My recollection was that thumb1 lacks atomics, barriers,
>> > thread-pointer loading, and maybe even syscalls, and since the
>> > kuser_helper addresses are arm addresses, you can't even use them to
>> > get the missing functionality.
>> >
>> > Rich
>> >
>> >> > diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h
>> >> > index c5c56f8..e3cb66a 100644
>> >> > --- a/arch/arm/atomic_arch.h
>> >> > +++ b/arch/arm/atomic_arch.h
>> >> > @@ -82,7 +82,7 @@ static inline void a_crash()
>> >> >                 : : : "memory");
>> >> >  }
>> >> >
>> >> > -#if __ARM_ARCH >= 5
>> >> > +#if __ARM_ARCH >= 5 && !(defined(__thumb__) && !defined(__thumb2))
>> >> >


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: clz instruction is unavailable for Thumb1
  2018-02-28  1:01   ` Rich Felker
  2018-02-28  1:26     ` Andre McCurdy
@ 2018-02-28  3:56     ` Khem Raj
  1 sibling, 0 replies; 8+ messages in thread
From: Khem Raj @ 2018-02-28  3:56 UTC (permalink / raw)
  To: musl, Rich Felker



On 2/27/18 5:01 PM, Rich Felker wrote:
> On Tue, Feb 27, 2018 at 04:37:15PM -0800, Andre McCurdy wrote:
>> On Tue, Feb 27, 2018 at 4:03 PM, Zhao, Weiming <weimingz@codeaurora.org> wrote:
>>> In arch/arm/atomic_arch.h, it checks for __ARM_ARCH >= 5, which is not
>>> sufficient.
>>>
>>> for example, for armv6-m, it only support Thumb1, which doesn't include clz.
>>>
>>> Suggest to check if it's building for thumb1:
>>
>> Musl does not currently support Thumb 1.
> 
> I forget what the situation with v6-m is, and whether/how it could be
> supportable. Is it really thumb1 or some thumb2 subset that fills
> deficiencies? My recollection was that thumb1 lacks atomics, barriers,
> thread-pointer loading, and maybe even syscalls, and since the
> kuser_helper addresses are arm addresses, you can't even use them to
> get the missing functionality.

v6-m doesn't have MMU IIRC, but it might be interesting as a FDPIC
platform.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: clz instruction is unavailable for Thumb1
  2018-02-28  3:00         ` Andre McCurdy
@ 2018-02-28 10:43           ` Szabolcs Nagy
  0 siblings, 0 replies; 8+ messages in thread
From: Szabolcs Nagy @ 2018-02-28 10:43 UTC (permalink / raw)
  To: musl

* Andre McCurdy <armccurdy@gmail.com> [2018-02-27 19:00:58 -0800]:
> On Tue, Feb 27, 2018 at 6:16 PM, Rich Felker <dalias@libc.org> wrote:
> > On Tue, Feb 27, 2018 at 05:26:13PM -0800, Andre McCurdy wrote:
> >> On Tue, Feb 27, 2018 at 5:01 PM, Rich Felker <dalias@libc.org> wrote:
> >> > I forget what the situation with v6-m is, and whether/how it could be
> >> > supportable. Is it really thumb1 or some thumb2 subset that fills
> >> > deficiencies?
> >>
> >> It's Thumb1 plus BL, DMB, DSB, ISB, MRS and MSR from Thumb2.
> >
> > So that covers barrier but not atomics or thread pointer or syscalls,
> > right?
> 
> Thumb1 can make syscalls, but armv6-m has no atomics (the RTOS style
> alternative being to disable interrupts around critical sections) and
> no thread pointer (no coprocessors at all).
> 
> > I'm not seeing how arm with only thumb1 plus the above can be a
> > viable platform musl could run on, but maybe there are some kernel
> > mechanisms to help..?
> 
> I don't know if it's even possible to run a Linux kernel on these devices.
> 

maybe this helps on linux:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8fcd6c45f5a65621ec809b7866a3623e9a01d4ed


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-02-28 10:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28  0:03 clz instruction is unavailable for Thumb1 Zhao, Weiming
2018-02-28  0:37 ` Andre McCurdy
2018-02-28  1:01   ` Rich Felker
2018-02-28  1:26     ` Andre McCurdy
2018-02-28  2:16       ` Rich Felker
2018-02-28  3:00         ` Andre McCurdy
2018-02-28 10:43           ` Szabolcs Nagy
2018-02-28  3:56     ` Khem Raj

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).