| 1 | ///////////////////////////////////////////////////////////////////////// |
| 2 | // |
| 3 | // Copyright (C) 2001-2012 The Bochs Project |
| 4 | // Copyright (C) 2017 Google Inc. |
| 5 | // |
| 6 | // This library is free software; you can redistribute it and/or |
| 7 | // modify it under the terms of the GNU Lesser General Public |
| 8 | // License as published by the Free Software Foundation; either |
| 9 | // version 2.1 of the License, or (at your option) any later version. |
| 10 | // |
| 11 | // This library is distributed in the hope that it will be useful, |
| 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | // Lesser General Public License for more details. |
| 15 | // |
| 16 | // You should have received a copy of the GNU Lesser General Public |
| 17 | // License along with this library; if not, see |
| 18 | // <https://www.gnu.org/licenses/>. |
| 19 | ///////////////////////////////////////////////////////////////////////// |
| 20 | /* |
| 21 | * x86 eflags functions |
| 22 | */ |
| 23 | |
| 24 | #ifndef X86_EMU_FLAGS_H |
| 25 | #define X86_EMU_FLAGS_H |
| 26 | |
| 27 | #include "cpu.h" |
| 28 | void lflags_to_rflags(CPUX86State *env); |
| 29 | void rflags_to_lflags(CPUX86State *env); |
| 30 | |
| 31 | bool get_CF(CPUX86State *env); |
| 32 | void set_CF(CPUX86State *env, bool val); |
| 33 | |
| 34 | void SET_FLAGS_OxxxxC(CPUX86State *env, bool new_of, bool new_cf); |
| 35 | |
| 36 | #ifdef TARGET_X86_64 |
| 37 | void SET_FLAGS_OSZAPC_SUB64(CPUX86State *env, uint64_t v1, uint64_t v2, |
| 38 | uint64_t diff); |
| 39 | #endif |
| 40 | void SET_FLAGS_OSZAPC_SUB32(CPUX86State *env, uint32_t v1, uint32_t v2, |
| 41 | uint32_t diff); |
| 42 | void SET_FLAGS_OSZAPC_SUB16(CPUX86State *env, uint16_t v1, uint16_t v2, |
| 43 | uint16_t diff); |
| 44 | void SET_FLAGS_OSZAPC_SUB8(CPUX86State *env, uint8_t v1, uint8_t v2, |
| 45 | uint8_t diff); |
| 46 | |
| 47 | #ifdef TARGET_X86_64 |
| 48 | void SET_FLAGS_OSZAPC_ADD64(CPUX86State *env, uint64_t v1, uint64_t v2, |
| 49 | uint64_t diff); |
| 50 | #endif |
| 51 | void SET_FLAGS_OSZAPC_ADD32(CPUX86State *env, uint32_t v1, uint32_t v2, |
| 52 | uint32_t diff); |
| 53 | void SET_FLAGS_OSZAPC_ADD16(CPUX86State *env, uint16_t v1, uint16_t v2, |
| 54 | uint16_t diff); |
| 55 | void SET_FLAGS_OSZAPC_ADD8(CPUX86State *env, uint8_t v1, uint8_t v2, |
| 56 | uint8_t diff); |
| 57 | |
| 58 | #ifdef TARGET_X86_64 |
| 59 | void SET_FLAGS_OSZAP_SUB64(CPUX86State *env, uint64_t v1, uint64_t v2, |
| 60 | uint64_t diff); |
| 61 | #endif |
| 62 | void SET_FLAGS_OSZAP_SUB32(CPUX86State *env, uint32_t v1, uint32_t v2, |
| 63 | uint32_t diff); |
| 64 | void SET_FLAGS_OSZAP_SUB16(CPUX86State *env, uint16_t v1, uint16_t v2, |
| 65 | uint16_t diff); |
| 66 | void SET_FLAGS_OSZAP_SUB8(CPUX86State *env, uint8_t v1, uint8_t v2, |
| 67 | uint8_t diff); |
| 68 | |
| 69 | #ifdef TARGET_X86_64 |
| 70 | void SET_FLAGS_OSZAP_ADD64(CPUX86State *env, uint64_t v1, uint64_t v2, |
| 71 | uint64_t diff); |
| 72 | #endif |
| 73 | void SET_FLAGS_OSZAP_ADD32(CPUX86State *env, uint32_t v1, uint32_t v2, |
| 74 | uint32_t diff); |
| 75 | void SET_FLAGS_OSZAP_ADD16(CPUX86State *env, uint16_t v1, uint16_t v2, |
| 76 | uint16_t diff); |
| 77 | void SET_FLAGS_OSZAP_ADD8(CPUX86State *env, uint8_t v1, uint8_t v2, |
| 78 | uint8_t diff); |
| 79 | |
| 80 | #ifdef TARGET_X86_64 |
| 81 | void SET_FLAGS_OSZAPC_LOGIC64(CPUX86State *env, uint64_t v1, uint64_t v2, |
| 82 | uint64_t diff); |
| 83 | #endif |
| 84 | void SET_FLAGS_OSZAPC_LOGIC32(CPUX86State *env, uint32_t v1, uint32_t v2, |
| 85 | uint32_t diff); |
| 86 | void SET_FLAGS_OSZAPC_LOGIC16(CPUX86State *env, uint16_t v1, uint16_t v2, |
| 87 | uint16_t diff); |
| 88 | void SET_FLAGS_OSZAPC_LOGIC8(CPUX86State *env, uint8_t v1, uint8_t v2, |
| 89 | uint8_t diff); |
| 90 | |
| 91 | #endif /* X86_EMU_FLAGS_H */ |