The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/compat/x86bios/x86bios.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2009 Alex Keda <admin@lissyara.su>
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  *
   26  * $FreeBSD: releng/11.1/sys/compat/x86bios/x86bios.h 298827 2016-04-30 00:34:04Z pfg $
   27  */
   28 /*
   29  * x86 registers were borrowed from x86emu.h x86emu_regs.h
   30  * for compatibility.
   31  */
   32 
   33 #ifndef _X86BIOS_H_
   34 #define _X86BIOS_H_
   35 
   36 #include <sys/endian.h>
   37 #include <sys/systm.h>
   38 #include <sys/types.h>
   39 
   40 #ifdef  __BIG_ENDIAN__
   41 
   42 struct x86_register32 {
   43         uint32_t                e_reg;
   44 };
   45 
   46 struct x86_register16 {
   47         uint16_t                filler0;
   48         uint16_t                x_reg;
   49 };
   50 
   51 struct x86_register8 {
   52         uint8_t                 filler0;
   53         uint8_t                 filler1;
   54         uint8_t                 h_reg;
   55         uint8_t                 l_reg;
   56 };
   57 
   58 #else /* !__BIG_ENDIAN__ */
   59 
   60 struct x86_register32 {
   61         uint32_t                e_reg;
   62 };
   63 
   64 struct x86_register16 {
   65         uint16_t                x_reg;
   66 };
   67 
   68 struct x86_register8 {
   69         uint8_t                 l_reg;
   70         uint8_t                 h_reg;
   71 };
   72 
   73 #endif /* __BIG_ENDIAN__ */
   74 
   75 union x86_register {
   76         struct x86_register32   I32_reg;
   77         struct x86_register16   I16_reg;
   78         struct x86_register8    I8_reg;
   79 };
   80 
   81 struct x86regs {
   82         uint16_t                _pad0;          /* CS */
   83         uint16_t                _pad1;          /* DS */
   84         uint16_t                register_es;
   85         uint16_t                register_fs;
   86         uint16_t                register_gs;
   87         uint16_t                _pad2;          /* SS */
   88         uint32_t                register_flags;
   89         union x86_register      register_a;
   90         union x86_register      register_b;
   91         union x86_register      register_c;
   92         union x86_register      register_d;
   93 
   94         union x86_register      _pad3;          /* SP */
   95         union x86_register      register_bp;
   96         union x86_register      register_si;
   97         union x86_register      register_di;
   98 };
   99 
  100 typedef struct x86regs  x86regs_t;
  101 
  102 /* 8 bit registers */
  103 #define R_AH            register_a.I8_reg.h_reg
  104 #define R_AL            register_a.I8_reg.l_reg
  105 #define R_BH            register_b.I8_reg.h_reg
  106 #define R_BL            register_b.I8_reg.l_reg
  107 #define R_CH            register_c.I8_reg.h_reg
  108 #define R_CL            register_c.I8_reg.l_reg
  109 #define R_DH            register_d.I8_reg.h_reg
  110 #define R_DL            register_d.I8_reg.l_reg
  111 
  112 /* 16 bit registers */
  113 #define R_AX            register_a.I16_reg.x_reg
  114 #define R_BX            register_b.I16_reg.x_reg
  115 #define R_CX            register_c.I16_reg.x_reg
  116 #define R_DX            register_d.I16_reg.x_reg
  117 
  118 /* 32 bit extended registers */
  119 #define R_EAX           register_a.I32_reg.e_reg
  120 #define R_EBX           register_b.I32_reg.e_reg
  121 #define R_ECX           register_c.I32_reg.e_reg
  122 #define R_EDX           register_d.I32_reg.e_reg
  123 
  124 /* special registers */
  125 #define R_BP            register_bp.I16_reg.x_reg
  126 #define R_SI            register_si.I16_reg.x_reg
  127 #define R_DI            register_di.I16_reg.x_reg
  128 #define R_FLG           register_flags
  129 
  130 /* special registers */
  131 #define R_EBP           register_bp.I32_reg.e_reg
  132 #define R_ESI           register_si.I32_reg.e_reg
  133 #define R_EDI           register_di.I32_reg.e_reg
  134 #define R_EFLG          register_flags
  135 
  136 /* segment registers */
  137 #define R_ES            register_es
  138 #define R_FS            register_fs
  139 #define R_GS            register_gs
  140 
  141 #define X86BIOS_PHYSTOSEG(x)    (((x) >> 4) & 0xff00)
  142 #define X86BIOS_PHYSTOOFF(x)    ((x) & 0x0fff)
  143 
  144 __BEGIN_DECLS
  145 void    *x86bios_alloc(uint32_t *offset, size_t size, int flags);
  146 void     x86bios_call(struct x86regs *regs, uint16_t seg, uint16_t off);
  147 void     x86bios_free(void *addr, size_t size);
  148 uint32_t x86bios_get_intr(int intno);
  149 void    *x86bios_get_orm(uint32_t offset);
  150 void     x86bios_init_regs(struct x86regs *regs);
  151 void     x86bios_intr(struct x86regs *regs, int intno);
  152 int      x86bios_match_device(uint32_t offset, device_t dev);
  153 void    *x86bios_offset(uint32_t offset);
  154 void     x86bios_set_intr(int intno, uint32_t saddr);
  155 __END_DECLS
  156 
  157 #endif /* !_X86BIOS_H_ */

Cache object: 7a027858874c4d3b13b87f6df63d2173


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.