1 \
   2 \ Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
   3 \ Use is subject to license terms.
   4 \
   5 \ Copyright 2018 Joyent, Inc.
   6 \
   7 \ CDDL HEADER START
   8 \
   9 \ The contents of this file are subject to the terms of the
  10 \ Common Development and Distribution License (the "License").
  11 \ You may not use this file except in compliance with the License.
  12 \
  13 \ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  14 \ or http://www.opensolaris.org/os/licensing.
  15 \ See the License for the specific language governing permissions
  16 \ and limitations under the License.
  17 \
  18 \ When distributing Covered Code, include this CDDL HEADER in each
  19 \ file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  20 \ If applicable, add the following below this CDDL HEADER, with the
  21 \ fields enclosed by brackets "[]" replaced with your own identifying
  22 \ information: Portions Copyright [yyyy] [name of copyright owner]
  23 \
  24 \ CDDL HEADER END
  25 \
  26 \ CPU-save structure offsets for use in assembly code.
  27 \
  28 
  29 #include <sys/cpuvar.h>
  30 #include <sys/kdi_impl.h>
  31 
  32 kdi_memrange_t  MR_SIZE
  33                 mr_base
  34                 mr_lim
  35 
  36 kdi_crumb_t     KRM_SIZE
  37                 krm_cpu_state
  38                 krm_pc
  39                 krm_sp
  40                 krm_trapno
  41                 krm_flag
  42 
  43 kdi_drreg_t
  44                 dr_ctl
  45                 dr_stat
  46                 dr_addr
  47 
  48 kdi_cpusave_t   KRS_SIZE
  49                 krs_gregs
  50                 krs_dr
  51                 krs_dr.dr_ctl                   KRS_DRCTL
  52                 krs_dr.dr_stat                  KRS_DRSTAT
  53                 krs_gdt
  54                 krs_idt
  55                 krs_cr0
  56                 krs_cpu_state
  57                 krs_curcrumbidx
  58                 krs_curcrumb
  59                 krs_crumbs
  60 
  61 greg_t          KREG_SIZE
  62 
  63 \#define        REG_SHIFT               3
  64 
  65 \#define        DRADDR_IDX(num)         _CONST(_MUL(num, DR_ADDR_INCR))
  66 \#define        DRADDR_OFF(num)         _CONST(DRADDR_IDX(num) + DR_ADDR)
  67 \#define        KRS_DROFF(num)          _CONST(DRADDR_OFF(num) + KRS_DR)
  68 \#define        REG_OFF(reg)            _CONST(_CONST(reg) << REG_SHIFT)
  69 \#define        KDIREG_OFF(reg)         _CONST(_MUL(KREG_SIZE, reg) + KRS_GREGS)