Print this page
OS-3735 modstubs MAXNARG is too low.

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/ia32/ml/modstubs.s
          +++ new/usr/src/uts/intel/ia32/ml/modstubs.s
↓ open down ↓ 42 lines elided ↑ open up ↑
  43   43   *      function call. Due to this we need to copy arguments for the
  44   44   *      real function. On Intel we can't tell how many arguments are there
  45   45   *      on the stack so we have to either copy everything between esp and
  46   46   *      ebp or copy only a fixed number (MAXNARG - defined here) for
  47   47   *      all the stub functions. Currently we are using MAXNARG (it is a kludge
  48   48   *      but worth it?!).
  49   49   *
  50   50   *      NOTE: Use NO_UNLOAD_STUBs if the module is NOT unloadable once it is
  51   51   *            loaded.
  52   52   */
  53      -#define MAXNARG 10
       53 +#define MAXNARG 12
  54   54  
  55   55  /*
  56   56   * WARNING: there is no check for forgetting to write END_MODULE,
  57   57   * and if you do, the kernel will most likely crash.  Be careful
  58   58   *
  59   59   * This file assumes that all of the contributions to the data segment
  60   60   * will be contiguous in the output file, even though they are separated
  61   61   * by pieces of text.  This is safe for all assemblers I know of now...
  62   62   */
  63   63  
↓ open down ↓ 113 lines elided ↑ open up ↑
 177  177          movq    %rax, %r15              /* stash the fcnname_info pointer */
 178  178          /*
 179  179           * save incoming register arguments
 180  180           */
 181  181          pushq   %rdi
 182  182          pushq   %rsi
 183  183          pushq   %rdx
 184  184          pushq   %rcx
 185  185          pushq   %r8
 186  186          pushq   %r9
 187      -        /* (next 4 args, if any, are already on the stack above %rbp) */
      187 +        /* (next 6 args, if any, are already on the stack above %rbp) */
 188  188          movq    %r15, %rdi
 189  189          call    mod_hold_stub           /* mod_hold_stub(mod_stub_info *) */
 190  190          cmpl    $-1, %eax               /* error? */
 191  191          jne     .L1
 192  192          movq    0x18(%r15), %rax
 193  193          call    *%rax
 194  194          addq    $0x30, %rsp
 195  195          jmp     .L2
 196  196  .L1:
 197  197          /*
 198      -         * copy MAXNARG == 10 incoming arguments
      198 +         * copy MAXNARG == 12 incoming arguments
 199  199           */
 200  200          popq    %r9
 201  201          popq    %r8
 202  202          popq    %rcx
 203  203          popq    %rdx
 204  204          popq    %rsi
 205  205          popq    %rdi
 206  206          /*
 207  207           * stack:
 208  208           *      arg9            0x38(%rsp)
↓ open down ↓ 3 lines elided ↑ open up ↑
 212  212           *      saved %rip      0x18(%rsp)
 213  213           *      saved %rbp      0x10(%rsp)
 214  214           *      <pad>           0x8(%rsp)
 215  215           *      saved %r15      0x0(%rsp)
 216  216           */
 217  217          movl    $MAXNARG - 6 + 3, %r11d
 218  218          pushq   (%rsp, %r11, 8)
 219  219          pushq   (%rsp, %r11, 8)
 220  220          pushq   (%rsp, %r11, 8)
 221  221          pushq   (%rsp, %r11, 8)
      222 +        pushq   (%rsp, %r11, 8)
      223 +        pushq   (%rsp, %r11, 8)
 222  224          call    *(%r15)                 /* call the stub fn(arg, ..) */
 223      -        addq    $0x20, %rsp             /* pop off last 4 args */
      225 +        addq    $0x30, %rsp             /* pop off last 6 args */
 224  226          pushq   %rax                    /* save any return values */
 225  227          pushq   %rdx
 226  228          movq    %r15, %rdi
 227  229          call    mod_release_stub        /* release hold on module */
 228  230          popq    %rdx                    /* restore return values */
 229  231          popq    %rax
 230  232  .L2:
 231  233          popq    %r15
 232  234          leave
 233  235          ret
↓ open down ↓ 97 lines elided ↑ open up ↑
 331  333          movl    MODS_RETFCN(%esi), %eax
 332  334          call    *%eax   
 333  335          popl    %esi                    / yes, return error (panic?)
 334  336          ret
 335  337  .L1:
 336  338          movl    $MAXNARG+1, %ecx
 337  339          / copy incoming arguments
 338  340          pushl   (%esp, %ecx, 4)         / push MAXNARG times
 339  341          pushl   (%esp, %ecx, 4)
 340  342          pushl   (%esp, %ecx, 4)
      343 +        pushl   (%esp, %ecx, 4)
      344 +        pushl   (%esp, %ecx, 4)
 341  345          pushl   (%esp, %ecx, 4)
 342  346          pushl   (%esp, %ecx, 4)
 343  347          pushl   (%esp, %ecx, 4)
 344  348          pushl   (%esp, %ecx, 4)
 345  349          pushl   (%esp, %ecx, 4)
 346  350          pushl   (%esp, %ecx, 4)
 347  351          pushl   (%esp, %ecx, 4)
 348  352          call    *(%esi)                 / call the stub function(arg1,arg2, ...)
 349  353          add     $_MUL(MAXNARG, 4), %esp / pop off MAXNARG arguments
 350  354          pushl   %eax                    / save any return values from the stub
↓ open down ↓ 1080 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX