mirror of
				https://github.com/netwide-assembler/nasm.git
				synced 2025-10-10 00:25:06 -04:00 
			
		
		
		
	ndisasm: REX2 *can* take REP or OSZ prefixes
Only VEX and EVEX may not take REP or OSZ prefixes. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
		| @@ -459,19 +459,26 @@ parse_prefixes(struct prefix_info *pf, const uint8_t *data, int bits) | |||||||
|             return NULL;        /* Invalid instruction */ |             return NULL;        /* Invalid instruction */ | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (pf->rex.type > REX_REX) { |     switch (pf->rex.type) { | ||||||
|  |     case REX_VEX: | ||||||
|  |     case REX_EVEX: | ||||||
|         if (pf->osp || pf->rep) |         if (pf->osp || pf->rep) | ||||||
|             return NULL;        /* Invalid instruction (illegal prefix) */ |             return NULL;        /* Invalid instruction (illegal prefix) */ | ||||||
|     } else { |         break; | ||||||
|         /* Redundant REX prefixes are ignored */ |  | ||||||
|         if (bits == 64) { |  | ||||||
|             while ((*p & 0xf0) == 0x40) { |  | ||||||
|                 p++; |  | ||||||
|                 if (p > maxp) |  | ||||||
|                     return NULL; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|  |     case REX_REX2: | ||||||
|  |         break; | ||||||
|  |  | ||||||
|  |     case REX_REX: | ||||||
|  |         /* Redundant REX prefixes are ignored */ | ||||||
|  |         while ((*p & 0xf0) == 0x40) { | ||||||
|  |             p++; | ||||||
|  |             if (p > maxp) | ||||||
|  |                 return NULL; | ||||||
|  |         } | ||||||
|  |         /* fall through */ | ||||||
|  |  | ||||||
|  |     case REX_NONE: | ||||||
|         /* |         /* | ||||||
|          * Look for legacy map prefixes. These must come after all |          * Look for legacy map prefixes. These must come after all | ||||||
|          * possible REX prefixes. |          * possible REX prefixes. | ||||||
| @@ -492,6 +499,8 @@ parse_prefixes(struct prefix_info *pf, const uint8_t *data, int bits) | |||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         pf->rex.xmap = pf->rex.map + MAP_BASE_NOVEX; | ||||||
|  |         break; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (p > maxp) |     if (p > maxp) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user