OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 "native_client/src/trusted/validator_ragel/unreviewed/parse_instruction.rl"; | 60 "native_client/src/trusted/validator_ragel/unreviewed/parse_instruction.rl"; |
61 | 61 |
62 include decode_x86_64 "decoder_x86_64_instruction.rl"; | 62 include decode_x86_64 "decoder_x86_64_instruction.rl"; |
63 | 63 |
64 main := (one_instruction | 64 main := (one_instruction |
65 @{ | 65 @{ |
66 switch (instruction.rm.disp_type) { | 66 switch (instruction.rm.disp_type) { |
67 case DISPNONE: instruction.rm.offset = 0; break; | 67 case DISPNONE: instruction.rm.offset = 0; break; |
68 case DISP8: instruction.rm.offset = (int8_t) *disp; break; | 68 case DISP8: instruction.rm.offset = (int8_t) *disp; break; |
69 case DISP16: instruction.rm.offset = | 69 case DISP16: instruction.rm.offset = |
70 (uint16_t) (disp[0] + 256U * disp[1]); | 70 (uint16_t) (disp[0] + 256U * disp[1]); |
Brad Chen
2012/09/28 20:41:01
Is it deliberate or accidental that you use uint16
khim
2012/09/28 23:22:06
It's just a typo - and an unimportant one at that
| |
71 break; | 71 break; |
72 case DISP32: instruction.rm.offset = (int32_t) | 72 case DISP32: instruction.rm.offset = (int32_t) |
73 (disp[0] + 256U * (disp[1] + 256U * (disp[2] + 256U * (disp[3])))); | 73 (disp[0] + 256U * (disp[1] + 256U * (disp[2] + 256U * (disp[3])))); |
74 break; | 74 break; |
75 case DISP64: instruction.rm.offset = (int64_t) | 75 case DISP64: instruction.rm.offset = (int64_t) |
76 (*disp + 256ULL * (disp[1] + 256ULL * (disp[2] + 256ULL * (disp[3] + | 76 (*disp + 256ULL * (disp[1] + 256ULL * (disp[2] + 256ULL * (disp[3] + |
77 256ULL * (disp[4] + 256ULL * (disp[5] + 256ULL * (disp[6] + 256ULL * | 77 256ULL * (disp[4] + 256ULL * (disp[5] + 256ULL * (disp[6] + 256ULL * |
78 disp[7]))))))); | 78 disp[7]))))))); |
79 break; | 79 break; |
80 } | 80 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 SET_REPZ_PREFIX(FALSE); | 207 SET_REPZ_PREFIX(FALSE); |
208 SET_BRANCH_NOT_TAKEN(FALSE); | 208 SET_BRANCH_NOT_TAKEN(FALSE); |
209 SET_BRANCH_TAKEN(FALSE); | 209 SET_BRANCH_TAKEN(FALSE); |
210 | 210 |
211 %% write init; | 211 %% write init; |
212 %% write exec; | 212 %% write exec; |
213 | 213 |
214 error_detected: | 214 error_detected: |
215 return result; | 215 return result; |
216 } | 216 } |
OLD | NEW |