Print this page
fix copyright fubar, reduce diffs
15254 %ymm registers not restored after signal handler
15367 x86 getfpregs() summons corrupting %xmm ghosts
15333 want x86 /proc xregs support (libc_db, libproc, mdb, etc.)
15336 want libc functions for extended ucontext_t
15334 want ps_lwphandle-specific reg routines
15328 FPU_CW_INIT mistreats reserved bit
15335 i86pc fpu_subr.c isn't really platform-specific
15332 setcontext(2) isn't actually noreturn
15331 need <sys/stdalign.h>
Change-Id: I7060aa86042dfb989f77fc3323c065ea2eafa9ad
Conflicts:
    usr/src/uts/common/fs/proc/prcontrol.c
    usr/src/uts/intel/os/archdep.c
    usr/src/uts/intel/sys/ucontext.h
    usr/src/uts/intel/syscall/getcontext.c

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/kmem.c
          +++ new/usr/src/uts/common/os/kmem.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
  23      - * Copyright (c) 2017, Joyent, Inc.
  24   23   * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
  25   24   * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  26   25   * Copyright 2018, Joyent, Inc.
  27      - * Copyright 2020 Oxide Computer Company
       26 + * Copyright 2023 Oxide Computer Company
  28   27   */
  29   28  
  30   29  /*
  31   30   * Kernel memory allocator, as described in the following two papers and a
  32   31   * statement about the consolidator:
  33   32   *
  34   33   * Jeff Bonwick,
  35   34   * The Slab Allocator: An Object-Caching Kernel Memory Allocator.
  36   35   * Proceedings of the Summer 1994 Usenix Conference.
  37   36   * Available as /shared/sac/PSARC/1994/028/materials/kmem.pdf.
↓ open down ↓ 2775 lines elided ↑ open up ↑
2813 2812                          kmem_slab_free(cp, KMEM_BUF(cp, head));
2814 2813                          head = next;
2815 2814                          nbufs--;
2816 2815                  }
2817 2816          }
2818 2817          ASSERT(head == NULL);
2819 2818          ASSERT(nbufs == 0);
2820 2819          mutex_enter(&cp->cache_lock);
2821 2820  }
2822 2821  
     2822 +/*
     2823 + * kmem_rezalloc() is currently considered private until we sort out how we want
     2824 + * to handle realloc vs. reallocf style interfaces.
     2825 + */
     2826 +void *
     2827 +kmem_rezalloc(void *oldbuf, size_t oldsize, size_t newsize, int kmflag)
     2828 +{
     2829 +        void *newbuf = kmem_alloc(newsize, kmflag);
     2830 +        if (newbuf == NULL) {
     2831 +                return (NULL);
     2832 +        }
     2833 +
     2834 +        bcopy(oldbuf, newbuf, MIN(oldsize, newsize));
     2835 +        if (newsize > oldsize) {
     2836 +                void *start = (void *)((uintptr_t)newbuf + oldsize);
     2837 +                bzero(start, newsize - oldsize);
     2838 +        }
     2839 +
     2840 +        if (oldbuf != NULL) {
     2841 +                ASSERT3U(oldsize, !=, 0);
     2842 +                kmem_free(oldbuf, oldsize);
     2843 +        }
     2844 +
     2845 +        return (newbuf);
     2846 +}
     2847 +
2823 2848  void *
2824 2849  kmem_zalloc(size_t size, int kmflag)
2825 2850  {
2826 2851          size_t index;
2827 2852          void *buf;
2828 2853  
2829 2854          if ((index = ((size - 1) >> KMEM_ALIGN_SHIFT)) < KMEM_ALLOC_TABLE_MAX) {
2830 2855                  kmem_cache_t *cp = kmem_alloc_table[index];
2831 2856                  buf = kmem_cache_alloc(cp, kmflag);
2832 2857                  if (buf != NULL) {
↓ open down ↓ 2601 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX