mailing list of musl libc
 help / color / Atom feed
* [musl] Data abort in __set_thread_area
@ 2020-06-04 19:36 erny hombre
  2020-06-04 19:52 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: erny hombre @ 2020-06-04 19:36 UTC (permalink / raw)
  To: musl

Hello,
 
I am writing an operating system for an ARM processor (Cortex-A9). For the user programs I want to use musl libc. I have built a toolchain with musl-cross-make (musl 1.2.0). I can link a user program with libc.a. After loading the program, I call _start. Then I run into a data abort in function __set_thread_area (/musl-1.2.0/src/env/__libc_start_main.c) at this statement:
int ver = *(int *)0xffff0ffc;
The data abort is reasonable, because no memory is mapped at this virtual address. I don't know what's the purpose of this code. Can anybody explain me what this function does and which environment is needed to make it work ?
 
Thanks,
Erwin

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

* Re: [musl] Data abort in __set_thread_area
  2020-06-04 19:36 [musl] Data abort in __set_thread_area erny hombre
@ 2020-06-04 19:52 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2020-06-04 19:52 UTC (permalink / raw)
  To: erny hombre; +Cc: musl

On Thu, Jun 04, 2020 at 09:36:37PM +0200, erny hombre wrote:
> Hello,
> 
> I am writing an operating system for an ARM processor (Cortex-A9).
> For the user programs I want to use musl libc. I have built a
> toolchain with musl-cross-make (musl 1.2.0). I can link a user
> program with libc.a. After loading the program, I call _start. Then
> I run into a data abort in function __set_thread_area
> (/musl-1.2.0/src/env/__libc_start_main.c) at this statement:
> 
> int ver = *(int *)0xffff0ffc;
> 
> The data abort is reasonable, because no memory is mapped at this
> virtual address. I don't know what's the purpose of this code. Can
> anybody explain me what this function does and which environment is
> needed to make it work ?

You need to either provide compatible kuser_helper functions mapped at
0xffff0000, or ensure HWCAP_TLS is set in the aux vector's AT_HWCAP to
indicate that the hardware thread pointer and atomics are available on
the particular cpu model.

Alternatively you can just ensure you build targeting armv7-a (to make
this the toolchain default configure it --with-arch=armv7-a) so that
this all gets hard-coded at compile time and there is no runtime
selection of atomics/tls access method.

Rich

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04 19:36 [musl] Data abort in __set_thread_area erny hombre
2020-06-04 19:52 ` Rich Felker

mailing list of musl libc

Archives are clonable: git clone --mirror http://inbox.vuxu.org/musl

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.musl


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git