case MEM_DIRECT:
/* format: 0b0mmm mmmm mmmm */
off = mem->offset;
- if (off & ~0x7FF) { //FIXME 4096 words for v15 arch possible?
- asm_warn(ctx, "DIRECT memoffset 0x%X too long (> 11 bits)", off);
- off &= 0x7FF;
+ switch (ctx->arch) {
+ case 5:
+ if (off & ~0x7FF) {
+ asm_warn(ctx, "DIRECT memoffset 0x%X too long (> 11 bits)", off);
+ off &= 0x7FF;
+ }
+ break;
+ case 15:
+ if (off & ~0xFFF) {
+ asm_warn(ctx, "DIRECT memoffset 0x%X too long (> 12 bits)", off);
+ off &= 0xFFF;
+ }
+ break;
+ default:
+ asm_error(ctx, "Internal error: generate_mem_operand invalid arch");
}
val |= off;
break;
asm_warn(ctx, "INDIRECT memoffset 0x%X too long (> 6 bits)", off);
off &= 0x3F;
}
- if (reg & ~0x7)
+ if (reg > 6) {
+ /* Assembler bug. The parser shouldn't pass this value. */
asm_error(ctx, "OFFR-nr too big");
+ }
+ if (reg == 6 && ctx->arch == 5) {
+ asm_warn(ctx, "Using offset register 6. This register is broken "
+ "on architecture 5 devices. Use off0 to off5 only.");
+ }
val |= off;
val |= (reg << 6);
break;
/* Search the last insn. */
if (out->type == OUT_INSN) {
if (out->is_jump_insn) {
- asm_error(ctx, "RET instruction directly after "
- "jump instruction. The hardware won't like this.");
+ asm_warn(ctx, "RET instruction directly after "
+ "jump instruction. The hardware won't like this.");
}
break;
}
if (arg_print_sizes) {
printf("%s: text = %u instructions (%u bytes)\n",
- fn, insn_count, insn_count * sizeof(uint64_t));
+ fn, insn_count,
+ (unsigned int)(insn_count * sizeof(uint64_t)));
}
fclose(fd);