github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/cpvmm/vmm/include/libc.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 _UVMM_CRT_H_
    16  #define _UVMM_CRT_H_
    17  
    18  #include "common_libc.h"
    19  
    20  
    21  // Set of CRT-like routines to be used in VMM environment
    22  
    23  #define EOF (-1)
    24  
    25  
    26  // Console I/O functions
    27  //
    28  // The normal version of putc() and puts() perform locking of the output as a
    29  // critical resource, in order to avoid intermingling of printed lines.
    30  // The "nolock" version of these functions just print to the output.  They
    31  // should be used in places, such as exception handlers, where there's a danger
    32  // of deadlock (should they be called while the output is locked).
    33  
    34  void    vmm_libc_init(void);
    35  int     vmm_puts(const char *string);
    36  int     vmm_puts_nolock(const char *string);
    37  UINT8   vmm_putc(UINT8 Char);
    38  UINT8   vmm_putc_nolock(UINT8 Char);
    39  UINT8   vmm_getc(void);
    40  
    41  //
    42  // Test function, active only if #ifdef'ed in
    43  
    44  void    vmm_print_test(UINT32 id);
    45  
    46  // vmm_printf() is declared in the common_libc.h
    47  // If uses global buffers and use locks for avoid cluttered prints on COM port
    48  
    49  //
    50  // vmm_printf_nolock()
    51  //
    52  // Like vmm_printf() but uses buffers on the stack and does not use locks
    53  //
    54  // Use it in the NMI handler to avoid deadlocks
    55  //
    56  int vmm_printf_nolock( const char *format, ... );
    57  
    58  #endif // _UVMM_CRT_H_