Print this page
8609 want a position independent CRT


  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 #include "thr_uberdata.h"
  27 #include <procfs.h>
  28 #include <ucontext.h>
  29 #include <setjmp.h>
  30 
  31 /*
  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
  41  */
  42 #undef  STACK_ALIGN
  43 #define STACK_ALIGN     16
  44 
  45 extern int getlwpstatus(thread_t, lwpstatus_t *);
  46 extern int putlwpregs(thread_t, prgregset_t);
  47 
  48 void *
  49 setup_top_frame(void *stk, size_t stksize, ulwp_t *ulwp)
  50 {
  51         uint32_t *stack;
  52         struct {
  53                 uint32_t        rpc;
  54                 uint32_t        arg;
  55                 uint32_t        pad;
  56                 uint32_t        fp;
  57                 uint32_t        pc;
  58         } frame;
  59 
  60         /*




  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 #include "thr_uberdata.h"
  27 #include <procfs.h>
  28 #include <ucontext.h>
  29 #include <setjmp.h>
  30 
  31 /*
  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/crt/i86/crti.s
  40  *  - lib/crt/i86/crt1.s
  41  */
  42 #undef  STACK_ALIGN
  43 #define STACK_ALIGN     16
  44 
  45 extern int getlwpstatus(thread_t, lwpstatus_t *);
  46 extern int putlwpregs(thread_t, prgregset_t);
  47 
  48 void *
  49 setup_top_frame(void *stk, size_t stksize, ulwp_t *ulwp)
  50 {
  51         uint32_t *stack;
  52         struct {
  53                 uint32_t        rpc;
  54                 uint32_t        arg;
  55                 uint32_t        pad;
  56                 uint32_t        fp;
  57                 uint32_t        pc;
  58         } frame;
  59 
  60         /*