Annotation of qemu/roms/seabios/src/bregs.h, revision 1.1

1.1     ! root        1: // Structure layout of cpu registers the the bios uses.
        !             2: //
        !             3: // Copyright (C) 2008  Kevin O'Connor <[email protected]>
        !             4: //
        !             5: // This file may be distributed under the terms of the GNU LGPLv3 license.
        !             6: 
        !             7: #ifndef __BREGS_H
        !             8: #define __BREGS_H
        !             9: 
        !            10: // CPU flag bitdefs
        !            11: #define F_CF (1<<0)
        !            12: #define F_ZF (1<<6)
        !            13: #define F_IF (1<<9)
        !            14: 
        !            15: // CR0 flags
        !            16: #define CR0_PG (1<<31) // Paging
        !            17: #define CR0_CD (1<<30) // Cache disable
        !            18: #define CR0_NW (1<<29) // Not Write-through
        !            19: #define CR0_PE (1<<0)  // Protection enable
        !            20: 
        !            21: 
        !            22: #ifndef __ASSEMBLY__
        !            23: 
        !            24: #include "farptr.h" // struct segoff_s
        !            25: 
        !            26: /****************************************************************
        !            27:  * Registers saved/restored in romlayout.S
        !            28:  ****************************************************************/
        !            29: 
        !            30: #include "types.h" // u16
        !            31: 
        !            32: #define UREG(ER, R, RH, RL) union { u32 ER; struct { u16 R; u16 R ## _hi; }; struct { u8 RL; u8 RH; u8 R ## _hilo; u8 R ## _hihi; }; }
        !            33: 
        !            34: // Layout of registers passed in to irq handlers.  Note that this
        !            35: // layout corresponds to code in romlayout.S - don't change it here
        !            36: // without also updating the assembler code.
        !            37: struct bregs {
        !            38:     u16 ds;
        !            39:     u16 es;
        !            40:     UREG(edi, di, di_hi, di_lo);
        !            41:     UREG(esi, si, si_hi, si_lo);
        !            42:     UREG(ebp, bp, bp_hi, bp_lo);
        !            43:     UREG(ebx, bx, bh, bl);
        !            44:     UREG(edx, dx, dh, dl);
        !            45:     UREG(ecx, cx, ch, cl);
        !            46:     UREG(eax, ax, ah, al);
        !            47:     struct segoff_s code;
        !            48:     u16 flags;
        !            49: } PACKED;
        !            50: 
        !            51: 
        !            52: /****************************************************************
        !            53:  * Helper functions
        !            54:  ****************************************************************/
        !            55: 
        !            56: static inline void
        !            57: set_cf(struct bregs *regs, int cond)
        !            58: {
        !            59:     if (cond)
        !            60:         regs->flags |= F_CF;
        !            61:     else
        !            62:         regs->flags &= ~F_CF;
        !            63: }
        !            64: 
        !            65: // Frequently used return codes
        !            66: #define RET_EUNSUPPORTED 0x86
        !            67: 
        !            68: static inline void
        !            69: set_success(struct bregs *regs)
        !            70: {
        !            71:     set_cf(regs, 0);
        !            72: }
        !            73: 
        !            74: static inline void
        !            75: set_code_success(struct bregs *regs)
        !            76: {
        !            77:     regs->ah = 0;
        !            78:     set_cf(regs, 0);
        !            79: }
        !            80: 
        !            81: static inline void
        !            82: set_invalid_silent(struct bregs *regs)
        !            83: {
        !            84:     set_cf(regs, 1);
        !            85: }
        !            86: 
        !            87: static inline void
        !            88: set_code_invalid_silent(struct bregs *regs, u8 code)
        !            89: {
        !            90:     regs->ah = code;
        !            91:     set_cf(regs, 1);
        !            92: }
        !            93: 
        !            94: #define warn_invalid(regs)                      \
        !            95:     __warn_invalid((regs), __LINE__, __func__)
        !            96: #define set_invalid(regs)                       \
        !            97:     __set_invalid((regs), __LINE__, __func__)
        !            98: #define set_code_invalid(regs, code)                                    \
        !            99:     __set_code_invalid((regs), (code) | (__LINE__ << 8), __func__)
        !           100: 
        !           101: #define warn_unimplemented(regs)                        \
        !           102:     __warn_unimplemented((regs), __LINE__, __func__)
        !           103: #define set_unimplemented(regs)                         \
        !           104:     __set_unimplemented((regs), __LINE__, __func__)
        !           105: #define set_code_unimplemented(regs, code)                              \
        !           106:     __set_code_unimplemented((regs), (code) | (__LINE__ << 8), __func__)
        !           107: 
        !           108: // output.c
        !           109: void __warn_invalid(struct bregs *regs, int lineno, const char *fname);
        !           110: void __warn_unimplemented(struct bregs *regs, int lineno, const char *fname);
        !           111: void __set_invalid(struct bregs *regs, int lineno, const char *fname);
        !           112: void __set_unimplemented(struct bregs *regs, int lineno, const char *fname);
        !           113: void __set_code_invalid(struct bregs *regs, u32 linecode, const char *fname);
        !           114: void __set_code_unimplemented(struct bregs *regs, u32 linecode
        !           115:                               , const char *fname);
        !           116: 
        !           117: #endif // !__ASSEMBLY__
        !           118: 
        !           119: #endif // bregs.h

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.