Changeset 9785


Ignore:
Timestamp:
Jun 18, 2008, 11:35:51 AM (11 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.

Location:
trunk/source/lisp-kernel
Files:
2 edited

Legend:

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

    r9056 r9785  
    188188
    189189BytePtr
    190 allocate_lisp_stack(unsigned useable,
     190allocate_lisp_stack(natural useable,
    191191                    unsigned softsize,
    192192                    unsigned hardsize,
     
    198198                    protected_area_ptr *hardp)
    199199{
    200   void *allocate_stack(unsigned);
     200  void *allocate_stack(natural);
    201201  void free_stack(void *);
    202202  natural size = useable+softsize+hardsize;
     
    248248area *
    249249allocate_lisp_stack_area(area_code stack_type,
    250                          unsigned useable,
     250                         natural usable,
    251251                         unsigned softsize,
    252252                         unsigned hardsize,
     
    260260  protected_area_ptr soft_area=NULL, hard_area=NULL;
    261261
    262   bottom = allocate_lisp_stack(useable,
     262  bottom = allocate_lisp_stack(usable,
    263263                               softsize,
    264264                               hardsize,
     
    301301
    302302area*
    303 allocate_vstack_holding_area_lock(unsigned usable)
     303allocate_vstack_holding_area_lock(natural usable)
    304304{
    305305  return allocate_lisp_stack_area(AREA_VSTACK,
     
    313313
    314314area *
    315 allocate_tstack_holding_area_lock(unsigned usable)
     315allocate_tstack_holding_area_lock(natural usable)
    316316{
    317317  return allocate_lisp_stack_area(AREA_TSTACK,
  • 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.