Commit: MSP430: Fix detection of NOP and EINT
Nick Clifton
nickc@redhat.com
Wed Apr 6 15:01:00 GMT 2016
More information about the Binutils mailing list
Wed Apr 6 15:01:00 GMT 2016
- Previous message (by thread): [Patch GAS Doc AArch64] Fix up "Architecture Extensions" section, add "lse".
- Next message (by thread): [PATCH 3/3] arc/nps400 : New cmem instructions and associated relocation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Guys, I am checking in the patch below to fix a small problem with the MSP430 assemblers and its detection of NOP and EINT. Prior to this patch the assembler would warn if an EINT instruction was not followed by a NOP, but the actual specification is that the EINT instruction should be preceded by a NOP instruction. The patch makes this change. Cheers Nick gas/ChangeLog 2016-04-06 Nick Clifton <nickc@redhat.com> * config/tc-msp430.c (msp430_operands): Check for a NOP preceding an EINT instruction. Warn/fix as necessary. * testsuite/gas/msp430/bad.s: Add test of EINT without preceding NOP. * testsuite/gas/msp430/bad.l: Update expected messages. Index: gas/config/tc-msp430.c =================================================================== RCS file: /cvs/cvsfiles/gnupro/gas/config/tc-msp430.c,v retrieving revision 1.24.2.3 diff -u -3 -p -r1.24.2.3 tc-msp430.c --- gas/config/tc-msp430.c 17 Feb 2016 09:04:16 -0000 1.24.2.3 +++ gas/config/tc-msp430.c 6 Apr 2016 11:15:58 -0000 @@ -2480,6 +2480,7 @@ msp430_operands (struct msp430_opcode_s bfd_boolean addr_op; const char * error_message; static signed int repeat_count = 0; + static bfd_boolean prev_insn_is_nop = FALSE; bfd_boolean fix_emitted; /* Opcode is the one from opcodes table @@ -2679,7 +2680,24 @@ msp430_operands (struct msp430_opcode_s switch (opcode->insn_opnumb) { case 0: - if (is_opcode ("eint") || is_opcode ("dint")) + if (is_opcode ("eint")) + { + if (! prev_insn_is_nop) + { + if (gen_interrupt_nops) + { + frag = frag_more (2); + bfd_putl16 ((bfd_vma) 0x4303 /* NOP */, frag); + dwarf2_emit_insn (2); + + if (warn_interrupt_nops) + as_warn (_("inserting a NOP before EINT")); + } + else if (warn_interrupt_nops) + as_warn (_("a NOP might be needed before the EINT")); + } + } + else if (is_opcode ("dint")) check_for_nop |= NOP_CHECK_INTERRUPT; /* Set/clear bits instructions. */ @@ -3866,6 +3884,11 @@ msp430_operands (struct msp430_opcode_s as_bad (_("Illegal instruction or not implemented opcode.")); } + if (is_opcode ("nop")) + prev_insn_is_nop = TRUE; + else + prev_insn_is_nop = FALSE; + input_line_pointer = line; return 0; } Index: gas/testsuite/gas/msp430/bad.l =================================================================== RCS file: /cvs/cvsfiles/gnupro/gas/testsuite/gas/msp430/bad.l,v retrieving revision 1.3 diff -u -3 -p -r1.3 bad.l --- gas/testsuite/gas/msp430/bad.l 18 Sep 2015 08:42:41 -0000 1.3 +++ gas/testsuite/gas/msp430/bad.l 6 Apr 2016 11:15:58 -0000 @@ -5,11 +5,13 @@ [^:]*:9: Error: junk found after instruction: mov.cd r1,r2 [^:]*:10: Warning: no size modifier after period, .w assumed [^:]*:11: Error: instruction bis.a does not exist -[^:]*:19: Warning: a NOP might be needed here because of successive changes in interrupt state -[^:]*:20: Warning: a NOP might be needed here because of successive changes in interrupt state -[^:]*:23: Warning: a NOP might be needed here because of successive changes in interrupt state +[^:]*:16: Warning: a NOP might be needed here because of successive changes in interrupt state +[^:]*:16: Warning: a NOP might be needed before the EINT [^:]*:25: Warning: a NOP might be needed here because of successive changes in interrupt state -[^:]*:26: Warning: a NOP might be needed here because of successive changes in interrupt state -[^:]*:27: Warning: a NOP might be needed here because of successive changes in interrupt state -[^:]*:28: Warning: a NOP might be needed here because of successive changes in interrupt state +[^:]*:25: Warning: a NOP might be needed before the EINT +[^:]*:29: Warning: a NOP might be needed here because of successive changes in interrupt state +[^:]*:31: Warning: a NOP might be needed here because of successive changes in interrupt state +[^:]*:32: Warning: a NOP might be needed here because of successive changes in interrupt state +[^:]*:33: Warning: a NOP might be needed here because of successive changes in interrupt state +[^:]*:34: Warning: a NOP might be needed here because of successive changes in interrupt state [^:]*: Warning: assembly finished without a possibly needed NOP instruction Index: gas/testsuite/gas/msp430/bad.s =================================================================== RCS file: /cvs/cvsfiles/gnupro/gas/testsuite/gas/msp430/bad.s,v retrieving revision 1.2 diff -u -3 -p -r1.2 bad.s --- gas/testsuite/gas/msp430/bad.s 11 Apr 2014 09:37:16 -0000 1.2 +++ gas/testsuite/gas/msp430/bad.s 6 Apr 2016 11:15:58 -0000 @@ -11,6 +11,12 @@ bis.a #8, r2 ;;; FIXME: Add more tests of assembler error detection here. + + ;; A NOP is needed *before* an EINT instruction. + eint + nop + ;; And *after* a DINT instruction. + dint ;; Changing interrupt states in two successive instructions ;; might cause an interrupt to be missed. The assembler
- Previous message (by thread): [Patch GAS Doc AArch64] Fix up "Architecture Extensions" section, add "lse".
- Next message (by thread): [PATCH 3/3] arc/nps400 : New cmem instructions and associated relocation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list