microldstop.hh (4867:2de05bc73640) microldstop.hh (5002:1b540e93ad34)
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * Redistribution and use of this software in source and binary forms,
6 * with or without modification, are permitted provided that the
7 * following conditions are met:
8 *

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

101
102 std::string generateDisassembly(Addr pc,
103 const SymbolTable *symtab) const;
104
105 template<class Context, class MemType>
106 Fault read(Context *xc, Addr EA, MemType & Mem, unsigned flags) const
107 {
108 Fault fault = NoFault;
1/*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * Redistribution and use of this software in source and binary forms,
6 * with or without modification, are permitted provided that the
7 * following conditions are met:
8 *

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

101
102 std::string generateDisassembly(Addr pc,
103 const SymbolTable *symtab) const;
104
105 template<class Context, class MemType>
106 Fault read(Context *xc, Addr EA, MemType & Mem, unsigned flags) const
107 {
108 Fault fault = NoFault;
109 int size = dataSize;
110 Addr alignedEA = EA & ~(dataSize - 1);
111 if (EA != alignedEA)
112 size *= 2;
113 switch(size)
109 switch(dataSize)
114 {
115 case 1:
110 {
111 case 1:
116 fault = xc->read(alignedEA, (uint8_t&)(Mem.a), flags);
112 fault = xc->read(EA, (uint8_t&)Mem, flags);
117 break;
118 case 2:
113 break;
114 case 2:
119 fault = xc->read(alignedEA, (uint16_t&)(Mem.a), flags);
115 fault = xc->read(EA, (uint16_t&)Mem, flags);
120 break;
121 case 4:
116 break;
117 case 4:
122 fault = xc->read(alignedEA, (uint32_t&)(Mem.a), flags);
118 fault = xc->read(EA, (uint32_t&)Mem, flags);
123 break;
124 case 8:
119 break;
120 case 8:
125 fault = xc->read(alignedEA, (uint64_t&)(Mem.a), flags);
121 fault = xc->read(EA, (uint64_t&)Mem, flags);
126 break;
122 break;
127 case 16:
128 fault = xc->read(alignedEA, Mem, flags);
129 break;
130 default:
123 default:
131 panic("Bad operand size %d for read at %#x.\n", size, EA);
124 panic("Bad operand size %d for read at %#x.\n", dataSize, EA);
132 }
133 return fault;
134 }
135
136 template<class Context, class MemType>
137 Fault write(Context *xc, MemType & Mem, Addr EA, unsigned flags) const
138 {
139 Fault fault = NoFault;
125 }
126 return fault;
127 }
128
129 template<class Context, class MemType>
130 Fault write(Context *xc, MemType & Mem, Addr EA, unsigned flags) const
131 {
132 Fault fault = NoFault;
140 int size = dataSize;
141 Addr alignedEA = EA & ~(dataSize - 1);
142 if (EA != alignedEA)
143 size *= 2;
144 switch(size)
133 switch(dataSize)
145 {
146 case 1:
134 {
135 case 1:
147 fault = xc->write((uint8_t&)(Mem.a), alignedEA, flags, 0);
136 fault = xc->write((uint8_t&)Mem, EA, flags, 0);
148 break;
149 case 2:
137 break;
138 case 2:
150 fault = xc->write((uint16_t&)(Mem.a), alignedEA, flags, 0);
139 fault = xc->write((uint16_t&)Mem, EA, flags, 0);
151 break;
152 case 4:
140 break;
141 case 4:
153 fault = xc->write((uint32_t&)(Mem.a), alignedEA, flags, 0);
142 fault = xc->write((uint32_t&)Mem, EA, flags, 0);
154 break;
155 case 8:
143 break;
144 case 8:
156 fault = xc->write((uint64_t&)(Mem.a), alignedEA, flags, 0);
145 fault = xc->write((uint64_t&)Mem, EA, flags, 0);
157 break;
146 break;
158 case 16:
159 fault = xc->write(Mem, alignedEA, flags, 0);
160 break;
161 default:
147 default:
162 panic("Bad operand size %d for write at %#x.\n", size, EA);
148 panic("Bad operand size %d for write at %#x.\n", dataSize, EA);
163 }
164 return fault;
165 }
166 };
167}
168
169#endif //__ARCH_X86_INSTS_MICROLDSTOP_HH__
149 }
150 return fault;
151 }
152 };
153}
154
155#endif //__ARCH_X86_INSTS_MICROLDSTOP_HH__