f9micro / f9-kernel

An efficient and secure microkernel built for ARM Cortex-M cores, inspired by L4
Other
683 stars 145 forks source link

L4_Sleep() failed #76

Closed bcbcarl closed 10 years ago

bcbcarl commented 10 years ago

F9 outputs unexpected result when using sleep function.

Sleep function:

void msec_sleep(L4_Word_t msec) {
  L4_Sleep(L4_TimePeriod(msec * 1000));
}

Output:

MEM:   fpage MEM0  [b:2000fb00, sz:2**8]
MEM:   fpage MEM0  [b:2000fc00, sz:2**8]
MEM:   fpage MEM0  [b:2000fd00, sz:2**8]
MEM:   fpage MEM0  [b:2000fe00, sz:2**9]
Address Space 00400002
MEM:   fpage KIP   [b:20000400, sz:2**8]
MEM:   fpage KIP   [b:20000500, sz:2**8]
MEM:   fpage UTEXT [b:2000ee00, sz:2**9]
MEM:   fpage UTEXT [b:2000f000, sz:2**8]
MEM: o fpage UTEXT [b:2000f100, sz:2**8]
MEM: o fpage UTEXT [b:2000f200, sz:2**9]
MEM: o fpage UTEXT [b:2000f400, sz:2**8]
MEM: o fpage UTEXT [b:2000f500, sz:2**8]
MEM: o fpage UTEXT [b:2000f600, sz:2**8]
MEM:   fpage UDATA [b:2000f700, sz:2**8]
MEM: o fpage UDATA [b:2000f800, sz:2**9]
MEM:   fpage MEM0  [b:2000fa00, sz:2**8]
MEM:   fpage MEM0  [b:2000fa00, sz:2**8]
MEM:   fpage MEM0  [b:2000fb00, sz:2**8]
MEM:   fpage MEM0  [b:2000fc00, sz:2**8]
MEM:   fpage MEM0  [b:2000fc00, sz:2**8]
MEM: o fpage MEM0  [b:2000fd00, sz:2**8]
MEM:   fpage MEM0  [b:2000fe00, sz:2**9]
-------TOP------
Init sampling...

Stack dump:
20000388 00000001 2000e380 e000ed34 08004a70 00000000 080016df 08004b6c 
00000001 e000ed34 00404002 2000fd98 08004a70 080043cd 00000002 0800551c 
2000fd5c 00000000 080016fb fffffffd 00000001 080051b4 00000000 08003f41 
2000e27c 08003b43 08003f48 61000000 08003f41 08003ec9 00000000 08003eb5 
00000300 08003f11 e000ed24 08003cf1 00000000 ffffffff 00000000
georgekang commented 10 years ago

This is because msec_sleep() is not a user space function. You should add "__USER_TEXT" attribute. However, timeout mechanism has not been implemented yet. Thread would be blocked forever when using it.

benwei commented 10 years ago

@georgekang Thanks for replay. I also encountered this issue.

georgekang commented 10 years ago

User space layer now is still at experimental state. Maybe it should be re-designed.

ahmedammar commented 10 years ago

I have some local fixes for this that I’m using, will share soon.

ahmedammar commented 10 years ago

Commit updated, removed changes to ipc_deliver.

jserv commented 10 years ago

Fixed in commit 9733ec77f3088d3ae54e1af49ed24f7f5b1d2a1c