diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2008-02-14 18:41:00 +0000 |
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2008-02-14 18:41:00 +0000 |
| commit | 76288e93f2550e2be55c8bb47468bfdbd9b17593 (patch) | |
| tree | cf54afd0ca8062879ea84d720412534bfa125745 /sys | |
| parent | 50fc08019cbdbb6ec8d21eeb4c1c9dcdf27d27cc (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/amd64/linux32/linux32_machdep.c | 27 | ||||
| -rw-r--r-- | sys/i386/linux/linux_machdep.c | 29 |
2 files changed, 29 insertions, 27 deletions
diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index 7a7ce0801040..565e6d22e8ea 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -907,21 +907,22 @@ linux_mmap_common(struct thread *td, struct l_mmap_argv *linux_args) PROC_UNLOCK(p); } - /* This gives us our maximum stack size */ - if (linux_args->len > STACK_SIZE - GUARD_SIZE) - bsd_args.len = linux_args->len; - else - bsd_args.len = STACK_SIZE - GUARD_SIZE; - /* - * This gives us a new BOS. If we're using VM_STACK, then - * mmap will just map the top SGROWSIZ bytes, and let - * the stack grow down to the limit at BOS. If we're - * not using VM_STACK we map the full stack, since we - * don't have a way to autogrow it. + * This gives us our maximum stack size and a new BOS. + * If we're using VM_STACK, then mmap will just map + * the top SGROWSIZ bytes, and let the stack grow down + * to the limit at BOS. If we're not using VM_STACK + * we map the full stack, since we don't have a way + * to autogrow it. */ - bsd_args.addr = (caddr_t)PTRIN(linux_args->addr) - - bsd_args.len; + if (linux_args->len > STACK_SIZE - GUARD_SIZE) { + bsd_args.addr = (caddr_t)PTRIN(linux_args->addr); + bsd_args.len = linux_args->len; + } else { + bsd_args.addr = (caddr_t)PTRIN(linux_args->addr) - + (STACK_SIZE - GUARD_SIZE - linux_args->len); + bsd_args.len = STACK_SIZE - GUARD_SIZE; + } } else { bsd_args.addr = (caddr_t)PTRIN(linux_args->addr); bsd_args.len = linux_args->len; diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c index a92c751fcd19..ded3b17b551a 100644 --- a/sys/i386/linux/linux_machdep.c +++ b/sys/i386/linux/linux_machdep.c @@ -758,21 +758,22 @@ linux_mmap_common(struct thread *td, struct l_mmap_argv *linux_args) PROC_UNLOCK(p); } - /* This gives us our maximum stack size */ - if (linux_args->len > STACK_SIZE - GUARD_SIZE) - bsd_args.len = linux_args->len; - else - bsd_args.len = STACK_SIZE - GUARD_SIZE; - - /* - * This gives us a new BOS. If we're using VM_STACK, then - * mmap will just map the top SGROWSIZ bytes, and let - * the stack grow down to the limit at BOS. If we're - * not using VM_STACK we map the full stack, since we - * don't have a way to autogrow it. + /* + * This gives us our maximum stack size and a new BOS. + * If we're using VM_STACK, then mmap will just map + * the top SGROWSIZ bytes, and let the stack grow down + * to the limit at BOS. If we're not using VM_STACK + * we map the full stack, since we don't have a way + * to autogrow it. */ - bsd_args.addr = (caddr_t)PTRIN(linux_args->addr) - - bsd_args.len; + if (linux_args->len > STACK_SIZE - GUARD_SIZE) { + bsd_args.addr = (caddr_t)PTRIN(linux_args->addr); + bsd_args.len = linux_args->len; + } else { + bsd_args.addr = (caddr_t)PTRIN(linux_args->addr) - + (STACK_SIZE - GUARD_SIZE - linux_args->len); + bsd_args.len = STACK_SIZE - GUARD_SIZE; + } } else { bsd_args.addr = (caddr_t)PTRIN(linux_args->addr); bsd_args.len = linux_args->len; |
