regop.isa (5427:1c389acefeb9) regop.isa (5428:5a27fea50fee)
1// Copyright (c) 2007-2008 The Hewlett-Packard Development Company
2// All rights reserved.
3//
4// Redistribution and use of this software in source and binary forms,
5// with or without modification, are permitted provided that the
6// following conditions are met:
7//
8// The software must be used only for Non-Commercial Use which means any

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

226 buildMe();
227 }
228}};
229
230output header {{
231 void
232 divide(uint64_t dividend, uint64_t divisor,
233 uint64_t &quotient, uint64_t &remainder);
1// Copyright (c) 2007-2008 The Hewlett-Packard Development Company
2// All rights reserved.
3//
4// Redistribution and use of this software in source and binary forms,
5// with or without modification, are permitted provided that the
6// following conditions are met:
7//
8// The software must be used only for Non-Commercial Use which means any

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

226 buildMe();
227 }
228}};
229
230output header {{
231 void
232 divide(uint64_t dividend, uint64_t divisor,
233 uint64_t &quotient, uint64_t &remainder);
234
235 enum SegmentSelectorCheck {
236 SegNoCheck, SegCSCheck, SegCallGateCheck,
237 SegSSCheck, SegIretCheck, SegIntCSCheck
238 };
234}};
235
236output decoder {{
237 void
238 divide(uint64_t dividend, uint64_t divisor,
239 uint64_t &quotient, uint64_t &remainder)
240 {
241 //Check for divide by zero.

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

1013 DestReg = SegAttrSrc1;
1014 '''
1015
1016 class Rdsel(SegOp):
1017 code = '''
1018 DestReg = SegSelSrc1;
1019 '''
1020
239}};
240
241output decoder {{
242 void
243 divide(uint64_t dividend, uint64_t divisor,
244 uint64_t &quotient, uint64_t &remainder)
245 {
246 //Check for divide by zero.

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

1018 DestReg = SegAttrSrc1;
1019 '''
1020
1021 class Rdsel(SegOp):
1022 code = '''
1023 DestReg = SegSelSrc1;
1024 '''
1025
1021 class Chks(SegOp):
1026 class Chks(RegOp):
1027 def __init__(self, dest, src1, src2=0,
1028 flags=None, dataSize="env.dataSize"):
1029 super(Chks, self).__init__(dest,
1030 src1, src2, flags, dataSize)
1022 code = '''
1023 // The selector is in source 1 and can be at most 16 bits.
1024 SegSelector selector = psrc1;
1025
1031 code = '''
1032 // The selector is in source 1 and can be at most 16 bits.
1033 SegSelector selector = psrc1;
1034
1035 switch (imm8)
1036 {
1037 case SegNoCheck:
1038 break;
1039 case SegCSCheck:
1040 panic("CS checks for far calls/jumps not implemented.\\n");
1041 break;
1042 case SegCallGateCheck:
1043 panic("CS checks for far calls/jumps through call gates"
1044 "not implemented.\\n");
1045 break;
1046 case SegSSCheck:
1047 panic("SS selector checks not implemented.\\n");
1048 break;
1049 case SegIretCheck:
1050 {
1051 SegAttr csAttr = CSAttr;
1052 if (!selector.si && !selector.ti)
1053 return new GeneralProtection(psrc1 & 0xFFFF);
1054 if (selector.rpl < csAttr.dpl)
1055 return new GeneralProtection(psrc1 & 0xFFFF);
1056 break;
1057 }
1058 case SegIntCSCheck:
1059 panic("CS selector checks for interrupts and exceptions"
1060 "not implemented.\\n");
1061 break;
1062 default:
1063 panic("Undefined segment check type.\\n");
1064 }
1065
1026 // Compute the address of the descriptor and set DestReg to it.
1027 if (selector.ti) {
1028 // A descriptor in the LDT
1029 Addr target = (selector.si << 3) + LDTRBase;
1030 if (!LDTRSel || (selector.si << 3) + dataSize > LDTRLimit)
1031 fault = new GeneralProtection(selector & mask(16));
1032 DestReg = target;
1033 } else {

--- 61 unchanged lines hidden ---
1066 // Compute the address of the descriptor and set DestReg to it.
1067 if (selector.ti) {
1068 // A descriptor in the LDT
1069 Addr target = (selector.si << 3) + LDTRBase;
1070 if (!LDTRSel || (selector.si << 3) + dataSize > LDTRLimit)
1071 fault = new GeneralProtection(selector & mask(16));
1072 DestReg = target;
1073 } else {

--- 61 unchanged lines hidden ---