github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/cpvmm/vmm/bootstrap/bootstrap_print.h (about)

     1  /*
     2   * File: bootstrap_print.h
     3   * Description: print support for bootstrap
     4   * Author: John Manferdelli from tboot code
     5   *
     6   * Copyright (c) 2006-2010, Intel Corporation
     7   *
     8   * Redistribution and use in source and binary forms, with or without
     9   * modification, are permitted provided that the following conditions
    10   * are met:
    11   *
    12   *   * Redistributions of source code must retain the above copyright
    13   *     notice, this list of conditions and the following disclaimer.
    14   *   * Redistributions in binary form must reproduce the above
    15   *     copyright notice, this list of conditions and the following
    16   *     disclaimer in the documentation and/or other materials provided
    17   *     with the distribution.
    18   *   * Neither the name of the Intel Corporation nor the names of its
    19   *     contributors may be used to endorse or promote products derived
    20   *     from this software without specific prior written permission.
    21   *
    22   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    23   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    24   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
    25   * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    26   * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
    27   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    28   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    29   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    30   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    31   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    32   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    33   * OF THE POSSIBILITY OF SUCH DAMAGE.
    34   *
    35   */
    36  
    37  #ifndef __BOOTSTRAP_PRINT_H__
    38  #define __BOOTSTRAP_PRINT_H__
    39  
    40  #define VGA_BASE                    0xb8000
    41  
    42  /* 80*25 text mode*/
    43  #define MAX_LINES                   25
    44  #define MAX_COLS                    80
    45  #define SCREEN_BUFFER               (MAX_LINES*MAX_COLS*2)
    46  #define VGA_ADDR(x, y)              (VGA_BASE + 2*(MAX_COLS*(y) + (x)))
    47  
    48  /* registers */
    49  #define CTL_ADDR_REG                0x3D4
    50  #define CTL_DATA_REG                0x3D5
    51  #define START_ADD_HIGH_REG          0x0C
    52  #define START_ADD_LOW_REG           0x0D
    53  
    54  /* colors */
    55  #define COLOR_BLACK                 0x00
    56  #define COLOR_BLUE                  0x01
    57  #define COLOR_GREEN                 0x02
    58  #define COLOR_CYAN                  0x03
    59  #define COLOR_RED                   0x04
    60  #define COLOR_MAGENTA               0x05
    61  #define COLOR_BROWN                 0x06
    62  #define COLOR_LTGRAY                0x07
    63  #define COLOR_DKGRAY                0x08
    64  #define COLOR_LTBLUE                0x09
    65  #define COLOR_LTGREEN               0x0A
    66  #define COLOR_LTCYAN                0x0B
    67  #define COLOR_LTRED                 0x0C
    68  #define COLOR_LTMAGENTA             0x0D
    69  #define COLOR_LTBROWN               0x0E
    70  #define COLOR_WHITE                 0x0F
    71  
    72  #define COLOR                       ((COLOR_BLACK << 4) | COLOR_LTGRAY)
    73  
    74  void vga_init(void);
    75  void vga_puts(const char *s, unsigned int cnt);
    76  
    77  
    78  
    79  #define vga_write(s,n)        vga_puts(s, n)
    80  
    81  extern void bprint_init(void);
    82  extern void bprint(const char *fmt, ...)
    83                           __attribute__ ((format (printf, 1, 2)));
    84  extern void bootstrap_partial_reset(void);
    85  
    86  #endif