github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/cpvmm/vmm/include/hw/hw_setjmp.h (about)

     1  /*
     2   * Copyright (c) 2013 Intel Corporation
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *     http://www.apache.org/licenses/LICENSE-2.0
     8   * Unless required by applicable law or agreed to in writing, software
     9   * distributed under the License is distributed on an "AS IS" BASIS,
    10   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    11   * See the License for the specific language governing permissions and
    12   * limitations under the License.
    13   */
    14  
    15  #ifndef _HW_SETJMP_H_
    16  #define _HW_SETJMP_H_
    17  
    18  
    19  #ifdef __GNUC__
    20  
    21  #define SETJMP_BUFFER_ITEMS  8  // Context saved registers:
    22                                  //    rbx, rbp,
    23                                  //    r12, r13, r14, r15,
    24                                  //    rsp, rip
    25  #else   // MS
    26  #define SETJMP_BUFFER_ITEMS 10  // Context saved registers:
    27                                  //    rbx, rsi, rdi, rbp,
    28                                  //    r12, r13, r14, r15,
    29                                  //    rsp, rip
    30  #endif
    31  
    32  typedef struct __jmp_buf {
    33  	unsigned long __rbx;
    34  	unsigned long __rsp;
    35  	unsigned long __rbp;
    36  	unsigned long __r12;
    37  	unsigned long __r13;
    38  	unsigned long __r14;
    39  	unsigned long __r15;
    40  	unsigned long __rip;
    41  } SETJMP_BUFFER;
    42  
    43  // typedef struct __jmp_buf SETJMP_BUFFER;
    44  // typedef UINT8 SETJMP_BUFFER[SETJMP_BUFFER_ITEMS * sizeof(ADDRESS)];
    45  
    46  
    47  extern int  setjmp(SETJMP_BUFFER *env);
    48  extern void longjmp(SETJMP_BUFFER *env, int errcode);
    49  extern void hw_exception_post_handler(void);
    50  
    51  
    52  
    53  #endif // _HW_SETJMP_H_
    54  
    55