Ignore:
Timestamp:
Jun 18, 2008, 11:35:51 AM (13 years ago)
Author:
gb
Message:

Try to ensure that the stack size(s) passed around are "natural"
integers. (On some platforms, mmap() may not be willing/able to
map more than a integer's worth of bytes in one swell foop; this
and related changes probably need a bit of thought; something
should enforce real stack size limits, somewhere.)

Please don't propagate these changes to other branches until we
see how this works.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/thread_manager.c

    r9303 r9785  
    734734{
    735735  extern area
    736     *allocate_vstack_holding_area_lock(unsigned),
    737     *allocate_tstack_holding_area_lock(unsigned);
     736    *allocate_vstack_holding_area_lock(natural),
     737    *allocate_tstack_holding_area_lock(natural);
    738738  area *a;
    739739  int i;
     
    972972#else
    973973Ptr
    974 create_stack(int size)
     974create_stack(natural size)
    975975{
    976976  Ptr p;
    977977  size=align_to_power_of_2(size, log2_page_size);
    978978  p = (Ptr) mmap(NULL,
    979                      (size_t)size,
    980                      PROT_READ | PROT_WRITE | PROT_EXEC,
    981                      MAP_PRIVATE | MAP_ANON | MAP_GROWSDOWN,
    982                      -1,        /* Darwin insists on this when not mmap()ing
    983                                 a real fd */
    984                      0);
     979                 (size_t)size,
     980                 PROT_READ | PROT_WRITE | PROT_EXEC,
     981                 MAP_PRIVATE | MAP_ANON | MAP_GROWSDOWN,
     982                 -1,    /* Darwin insists on this when not mmap()ing
     983                          a real fd */
     984                 0);
    985985  if (p != (Ptr)(-1)) {
    986986    *((size_t *)p) = size;
     
    993993
    994994void *
    995 allocate_stack(unsigned size)
     995allocate_stack(natural size)
    996996{
    997997  return create_stack(size);
     
    10751075{
    10761076  thread_activation *activation = (thread_activation *)param;
    1077   TCR *tcr = new_tcr(activation->vsize, activation->vsize);
     1077  TCR *tcr = new_tcr(activation->vsize, activation->tsize);
    10781078  sigset_t mask, old_mask;
    10791079
Note: See TracChangeset for help on using the changeset viewer.