Print this page
6507 i386 makecontext(3c) needs to 16-byte align the stack

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc/i386/threads/machdep.c
          +++ new/usr/src/lib/libc/i386/threads/machdep.c
↓ open down ↓ 21 lines elided ↑ open up ↑
  22   22  /*
  23   23   * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   */
  25   25  
  26   26  #include "thr_uberdata.h"
  27   27  #include <procfs.h>
  28   28  #include <ucontext.h>
  29   29  #include <setjmp.h>
  30   30  
  31   31  /*
  32      - * The i386 ABI says that the stack pointer need be only 4-byte aligned
  33      - * before a function call (STACK_ALIGN == 4).  We use a 16-byte stack
  34      - * alignment for the benefit of floating point code compiled using sse2.
  35      - * Even though the i386 ABI doesn't require it, both cc and gcc
  36      - * assume this alignment on entry to a function and maintain it
  37      - * for calls made from that function.  If the stack is initially
  38      - * aligned on a 16-byte boundary, it will continue to be so aligned.
  39      - * If it is not initially so aligned, it will never become so aligned.
       32 + * The stack needs to be 16-byte aligned with a 4-byte bias.  See comment in
       33 + * lib/libc/i386/gen/makectxt.c.
       34 + *
       35 + * Note: If you change it, you need to change it in the following files as
       36 + * well:
       37 + *
       38 + *  - lib/libc/i386/gen/makectxt.c
       39 + *  - lib/common/i386/crti.s
       40 + *  - lib/common/i386/crt1.s
  40   41   */
  41   42  #undef  STACK_ALIGN
  42   43  #define STACK_ALIGN     16
  43   44  
  44   45  extern int getlwpstatus(thread_t, lwpstatus_t *);
  45   46  extern int putlwpregs(thread_t, prgregset_t);
  46   47  
  47   48  void *
  48   49  setup_top_frame(void *stk, size_t stksize, ulwp_t *ulwp)
  49   50  {
↓ open down ↓ 214 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX