utility.cc (9759:8f1f1bdedf8c) utility.cc (9765:da0e0df0ba97)
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * Copyright (c) 2011 Advanced Micro Devices, Inc.
4 * All rights reserved.
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

--- 254 unchanged lines hidden (view full) ---

263 tc->setIntReg(X86ISA::INTREG_PSEUDO(3), 0);
264 tc->setIntReg(X86ISA::INTREG_PSEUDO(4), 0);
265
266 // Update the RFLAGS misc reg with whatever didn't go into the
267 // magic registers.
268 tc->setMiscReg(MISCREG_RFLAGS, val & ~(ccFlagMask | cfofMask | DFBit));
269}
270
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * Copyright (c) 2011 Advanced Micro Devices, Inc.
4 * All rights reserved.
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating

--- 254 unchanged lines hidden (view full) ---

263 tc->setIntReg(X86ISA::INTREG_PSEUDO(3), 0);
264 tc->setIntReg(X86ISA::INTREG_PSEUDO(4), 0);
265
266 // Update the RFLAGS misc reg with whatever didn't go into the
267 // magic registers.
268 tc->setMiscReg(MISCREG_RFLAGS, val & ~(ccFlagMask | cfofMask | DFBit));
269}
270
271uint16_t
272genX87Tags(uint16_t ftw, uint8_t top, int8_t spm)
273{
274 const uint8_t new_top((top + spm + 8) % 8);
275
276 if (spm > 0) {
277 // Removing elements from the stack. Flag the elements as empty.
278 for (int i = top; i != new_top; i = (i + 1 + 8) % 8)
279 ftw |= 0x3 << (2 * i);
280 } else if (spm < 0) {
281 // Adding elements to the stack. Flag the new elements as
282 // valid. We should ideally decode them and "do the right
283 // thing".
284 for (int i = new_top; i != top; i = (i + 1 + 8) % 8)
285 ftw &= ~(0x3 << (2 * i));
286 }
287
288 return ftw;
289}
290
271} // namespace X86_ISA
291} // namespace X86_ISA