l4/sys/syscalls.h: No such file or directory

Björn Döbel doebel at os.inf.tu-dresden.de
Wed Sep 17 16:31:25 CEST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Values in decimal notation:
> 
> thread_stacks[count]: 12320

In hex that is 0x3020 -> This address is certainly not aligned to a
page boundary. That would be something like 0x3000 or 0x4000.

I just saw in your previous email that you are calling memalign like this:

posix_memalign((void**)&thread_stacks[count],
               (size_t)L4_LOG2_PAGESIZE,
               (size_t)stack_size)

The second argument to this function is the alignment. Let's have a
look at the man page:

"The address of the allocated memory will be a multiple of alignment,
 which must be a power of two and a multiple of sizeof(void *)."

You are passing L4_LOG2_PAGESIZE, which is defined as an alias to
L4_PAGESHIFT and hence equals 12 (note: not a power of 2). You want to
pass L4_PAGESIZE here, which is 4096 and fulfills the constraints
mentioned in the manpage.

> thread_stacks[count][0]: 0 thread_stacks[count][THREAD_STACK_SIZE -
> 1]: 0 (for thread with no. 0) 
> thread_stacks[count][THREAD_STACK_SIZE - 2]: 0
> 
>> Maybe because your program is trying to push data onto the stack?
>> I have no idea because you did not tell us about the actual
>> instruction at address 0x1000200.
> 
> It's simply the head of the function. addr2line gives me line 27 of
> examples/libedft-example/main.c, so it's the opening bracket of the
> thread function:
>> void thread_func(l4_umword_t no) { /* line 27 */ printf("Hello
>> World!\n"); edft_release_cap(no); }

Usually, your compiler generates a certain number of prefix
instructions for every function. The prefix for GCC is something like

PUSH EBP
MOV EBP, ESP

(to validate this: use objdump to disassemble your binary and check
 what is there at address 0x1000200.).

So, this instruction is likely to be a PUSH. Hence your program will
try to write to the next machine word BELOW your intially set stack
pointer. (Again, check with objdump if in doubt.)

In the end means, that your stack mapping did not succeed as intended.
Your reported PF address was also 0xb014, therefore I would suggest
checking

* Are you really mapping to the proper stack address?
  -> printf() the values that you put into the task_map() call.
* Does the mapping work?
  -> you can put an enter_kdebug("") after the task_map call.
  At this point the target address space will not have the memory
  actually mapped, hence dumping the address will show you empty
  memory. However, you could check the target's page table
  (JDB command 'p<taskno>') for the respective entry.

Bjoern
- -- 
Dipl.-Inf. Bjoern Doebel    Mail:  doebel at tudos.org
TU Dresden, OS Chair        Phone: +49 351 463 38 799
Noethnitzer Str. 46         Fax:   +49 351 463 38 284
01187 Dresden, Germany      WWW:   http://www.tudos.org/~doebel
- --
"When the seagulls follow the trawler, it's because they think
 sardines will be thrown into the sea." (Eric Cantona)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlQZmzoACgkQP5ijxgQLUNnO9ACfeuG7TQVNf0wU/cgOZhkwgd/V
gw8An3NUxYEeg9S4tki928zq5PAOmOJh
=EU+m
-----END PGP SIGNATURE-----



More information about the l4-hackers mailing list