Re: [Qemu-devel] [PATCH V6 1/6] oslib-posix: add helpers for stack alloc and free

2016-08-23 Thread Peter Lieven
Am 22.08.2016 um 17:19 schrieb Richard Henderson: On 08/22/2016 06:04 AM, Peter Lieven wrote: +static size_t adjust_stack_size(size_t sz) +{ +#ifdef _SC_THREAD_STACK_MIN +/* avoid stacks smaller than _SC_THREAD_STACK_MIN */ +sz = MAX(MAX(sysconf(_SC_THREAD_STACK_MIN), 0), sz); +#endif

Re: [Qemu-devel] [PATCH V6 1/6] oslib-posix: add helpers for stack alloc and free

2016-08-22 Thread Richard Henderson
On 08/22/2016 06:04 AM, Peter Lieven wrote: +static size_t adjust_stack_size(size_t sz) +{ +#ifdef _SC_THREAD_STACK_MIN +/* avoid stacks smaller than _SC_THREAD_STACK_MIN */ +sz = MAX(MAX(sysconf(_SC_THREAD_STACK_MIN), 0), sz); +#endif You need to place the sysconf result into a local v

[Qemu-devel] [PATCH V6 1/6] oslib-posix: add helpers for stack alloc and free

2016-08-22 Thread Peter Lieven
the allocated stack will be adjusted to the minimum supported stack size by the OS and rounded up to be a multiple of the system pagesize. Additionally an architecture dependent guard page is added to the stack to catch stack overflows. The memory for the guard page is deductated from stack memory