1 /* tc-m68k.c All the m68020 specific stuff in one convenient, huge,
2 slow to compile, easy to find file.
4 Copyright (C) 1987, 1991, 1992 Free Software Foundation, Inc.
6 This file is part of GAS, the GNU Assembler.
8 GAS is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GAS is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GAS; see the file COPYING. If not, write to
20 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
28 /* note that this file includes real declarations and thus can only be included by one source file per executable. */
29 #include "opcode/m68k.h"
31 /* This variable contains the value to write out at the beginning of
32 the a.out file. The 2<<16 means that this is a 68020 file instead
33 of an old-style 68000 file */
35 long omagic
= 2<<16|OMAGIC
; /* Magic byte for header file */
40 /* This array holds the chars that always start a comment. If the
41 pre-processor is disabled, these aren't very useful */
42 const char comment_chars
[] = "|";
44 /* This array holds the chars that only start a comment at the beginning of
45 a line. If the line seems to have the form '# 123 filename'
46 .line and .file directives will appear in the pre-processed output */
47 /* Note that input_file.c hand checks for '#' at the beginning of the
48 first line of the input file. This is because the compiler outputs
49 #NO_APP at the beginning of its output. */
50 /* Also note that comments like this one will always work. */
51 const char line_comment_chars
[] = "#";
53 /* Chars that can be used to separate mant from exp in floating point nums */
54 const char EXP_CHARS
[] = "eE";
56 /* Chars that mean this number is a floating point constant */
60 const char FLT_CHARS
[] = "rRsSfFdDxXeEpP";
62 /* Also be aware that MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT may have to be
63 changed in read.c . Ideally it shouldn't have to know about it at all,
64 but nothing is ideal around here.
67 int md_reloc_size
= 8; /* Size of relocation record */
69 /* Its an arbitrary name: This means I don't approve of it */
70 /* See flames below */
71 static struct obstack robyn
;
73 #define TAB(x,y) (((x)<<2)+(y))
74 #define TABTYPE(xy) ((xy) >> 2)
87 /* Operands we can parse: (And associated modes)
93 reg: address or data register
94 areg: address register
95 apc: address register, PC, ZPC or empty string
98 sz: w or l if omitted, l assumed
99 scale: 1 2 4 or 8 if omitted, 1 assumed
101 7.4 IMMED #num --> NUM
102 0.? DREG dreg --> dreg
103 1.? AREG areg --> areg
104 2.? AINDR areg@ --> *(areg)
105 3.? AINC areg@+ --> *(areg++)
106 4.? ADEC areg@- --> *(--areg)
107 5.? AOFF apc@(numw) --> *(apc+numw) -- empty string and ZPC not allowed here
108 6.? AINDX apc@(num,reg:sz:scale) --> *(apc+num+reg*scale)
109 6.? AINDX apc@(reg:sz:scale) --> same, with num=0
110 6.? APODX apc@(num)@(num2,reg:sz:scale) --> *(*(apc+num)+num2+reg*scale)
111 6.? APODX apc@(num)@(reg:sz:scale) --> same, with num2=0
112 6.? AMIND apc@(num)@(num2) --> *(*(apc+num)+num2) (previous mode without an index reg)
113 6.? APRDX apc@(num,reg:sz:scale)@(num2) --> *(*(apc+num+reg*scale)+num2)
114 6.? APRDX apc@(reg:sz:scale)@(num2) --> same, with num=0
115 7.0 ABSL num:sz --> *(num)
116 num --> *(num) (sz L assumed)
117 *** MSCR otherreg --> Magic
119 5.? AOFF apc@(num) --> *(apc+num) -- empty string and ZPC not allowed here still
120 ?.? DINDR dreg@ --> (dreg) -- cas2 only
130 a1@(5,d2:w:1) @(45,d6:l:4)
135 #name@(numw) -->turn into PC rel mode
136 apc@(num8,reg:sz:scale) --> *(apc+num8+reg*scale)
163 short e_siz
; /* 0== default 1==short/byte 2==word 3==long */
166 /* DATA and ADDR have to be contiguous, so that reg-DATA gives 0-7==data reg,
167 8-15==addr reg for operands that take both types */
170 DATA
= 1, /* 1- 8 == data registers 0-7 */
190 /* Note that COPNUM==processor #1 -- COPNUM+7==#8, which stores as 000 */
195 FPREG
, /* Eight FP registers */
204 COPNUM
= (FPREG
+8), /* Co-processor #1-#8 */
213 PC
, /* Program counter */
214 ZPC
, /* Hack for Program space, but 0 addressing */
216 CCR
, /* Condition code Reg */
218 /* These have to be in order for the movec instruction to work. */
219 USP
, /* User Stack Pointer */
220 ISP
, /* Interrupt stack pointer */
235 /* end of movec ordering constraints */
241 DRP
, /* 68851 or 68030 MMU regs */
265 PSR
, /* aka MMUSR on 68030 (but not MMUSR on 68040)
266 and ACUSR on 68ec030 */
269 IC
, /* instruction cache token */
270 DC
, /* data cache token */
271 NC
, /* no cache token */
272 BC
, /* both caches token */
274 TT0
, /* 68030 access control unit regs */
278 /* Internal form of an operand. */
280 char *error
; /* Couldn't parse it */
281 enum operand_type mode
; /* What mode this instruction is in. */
282 enum _register reg
; /* Base register */
283 struct m68k_exp
*con1
;
284 int ireg
; /* Index register */
285 int isiz
; /* 0==unspec 1==byte(?) 2==short 3==long */
286 int imul
; /* Multipy ireg by this (1,2,4,or 8) */
287 struct m68k_exp
*con2
;
290 /* internal form of a 68020 instruction */
293 char *args
; /* list of opcode info */
296 int numo
; /* Number of shorts in opcode */
299 struct m68k_op operands
[6];
301 int nexp
; /* number of exprs in use */
302 struct m68k_exp exprs
[4];
304 int nfrag
; /* Number of frags we have to produce */
306 int fragoff
; /* Where in the current opcode[] the frag ends */
312 int nrel
; /* Num of reloc strucs in use */
320 } reloc
[5]; /* Five is enough??? */
323 #define cpu_of_arch(x) ((x) & m68000up)
324 #define float_of_arch(x) ((x) & mfloat)
325 #define mmu_of_arch(x) ((x) & mmmu)
327 static struct m68k_it the_ins
; /* the instruction being assembled */
329 /* Macros for adding things to the m68k_it struct */
331 #define addword(w) the_ins.opcode[the_ins.numo++]=(w)
333 /* Like addword, but goes BEFORE general operands */
334 #define insop(w) {int z;\
335 for(z=the_ins.numo;z>opcode->m_codenum;--z)\
336 the_ins.opcode[z]=the_ins.opcode[z-1];\
337 for(z=0;z<the_ins.nrel;z++)\
338 the_ins.reloc[z].n+=2;\
339 the_ins.opcode[opcode->m_codenum]=w;\
344 #define add_exp(beg,end) (\
345 the_ins.exprs[the_ins.nexp].e_beg=beg,\
346 the_ins.exprs[the_ins.nexp].e_end=end,\
347 &the_ins.exprs[the_ins.nexp++]\
351 /* The numo+1 kludge is so we can hit the low order byte of the prev word. Blecch*/
352 #define add_fix(width,exp,pc_rel) {\
353 the_ins.reloc[the_ins.nrel].n= ((width)=='B') ? (the_ins.numo*2-1) : \
354 (((width)=='b') ? ((the_ins.numo-1)*2) : (the_ins.numo*2));\
355 the_ins.reloc[the_ins.nrel].add=adds((exp));\
356 the_ins.reloc[the_ins.nrel].sub=subs((exp));\
357 the_ins.reloc[the_ins.nrel].off=offs((exp));\
358 the_ins.reloc[the_ins.nrel].wid=width;\
359 the_ins.reloc[the_ins.nrel++].pcrel=pc_rel;\
362 #define add_frag(add,off,type) {\
363 the_ins.fragb[the_ins.nfrag].fragoff=the_ins.numo;\
364 the_ins.fragb[the_ins.nfrag].fadd=add;\
365 the_ins.fragb[the_ins.nfrag].foff=off;\
366 the_ins.fragb[the_ins.nfrag++].fragty=type;\
369 #define isvar(exp) ((exp) && (adds(exp) || subs(exp)))
371 #define seg(exp) ((exp)->e_exp.X_seg)
372 #define adds(exp) ((exp)->e_exp.X_add_symbol)
373 #define subs(exp) ((exp)->e_exp.X_subtract_symbol)
374 #define offs(exp) ((exp)->e_exp.X_add_number)
379 unsigned long m_opcode
;
382 enum m68k_architecture m_arch
;
383 struct m68k_incant
*m_next
;
386 #define getone(x) ((((x)->m_opcode)>>16)&0xffff)
387 #define gettwo(x) (((x)->m_opcode)&0xffff)
392 static char *crack_operand(char *str
, struct m68k_op
*opP
);
393 static int get_num(struct m68k_exp
*exp
, int ok
);
394 static int get_regs(int i
, char *str
, struct m68k_op
*opP
);
395 static int reverse_16_bits(int in
);
396 static int reverse_8_bits(int in
);
397 static int try_index(char **s
, struct m68k_op
*opP
);
398 static void install_gen_operand(int mode
, int val
);
399 static void install_operand(int mode
, int val
);
401 static void s_data1(void);
402 static void s_data2(void);
403 static void s_even(void);
404 static void s_proc(void);
406 #else /* not __STDC__ */
408 static char *crack_operand();
409 static int get_num();
410 static int get_regs();
411 static int reverse_16_bits();
412 static int reverse_8_bits();
413 static int try_index();
414 static void install_gen_operand();
415 static void install_operand();
417 void s_align_bytes();
418 static void s_data1();
419 static void s_data2();
420 static void s_even();
421 static void s_proc();
423 #endif /* not __STDC__ */
425 static enum m68k_architecture current_architecture
= 0;
427 /* BCC68000 is for patching in an extra jmp instruction for long offsets
428 on the 68000. The 68000 doesn't support long branches with branchs */
430 /* This table desribes how you change sizes for the various types of variable
431 size expressions. This version only supports two kinds. */
433 /* Note that calls to frag_var need to specify the maximum expansion needed */
434 /* This is currently 10 bytes for DBCC */
437 How far Forward this mode will reach:
438 How far Backward this mode will reach:
439 How many bytes this mode will add to the size of the frag
440 Which mode to go to if the offset won't fit in this one
444 { 1, 1, 0, 0 }, /* First entries aren't used */
445 { 1, 1, 0, 0 }, /* For no good reason except */
446 { 1, 1, 0, 0 }, /* that the VAX doesn't either */
449 { (127), (-128), 0, TAB(BRANCH
,SHORT
)},
450 { (32767), (-32768), 2, TAB(BRANCH
,LONG
) },
454 { 1, 1, 0, 0 }, /* FBRANCH doesn't come BYTE */
455 { (32767), (-32768), 2, TAB(FBRANCH
,LONG
)},
459 { 1, 1, 0, 0 }, /* PCREL doesn't come BYTE */
460 { (32767), (-32768), 2, TAB(PCREL
,LONG
)},
464 { (127), (-128), 0, TAB(BCC68000
,SHORT
)},
465 { (32767), (-32768), 2, TAB(BCC68000
,LONG
) },
466 { 0, 0, 6, 0 }, /* jmp long space */
469 { 1, 1, 0, 0 }, /* DBCC doesn't come BYTE */
470 { (32767), (-32768), 2, TAB(DBCC
,LONG
) },
471 { 0, 0, 10, 0 }, /* bra/jmp long space */
474 { 1, 1, 0, 0 }, /* PCLEA doesn't come BYTE */
475 { 32767, -32768, 2, TAB(PCLEA
,LONG
) },
481 /* These are the machine dependent pseudo-ops. These are included so
482 the assembler can work on the output from the SUN C compiler, which
486 /* This table describes all the machine specific pseudo-ops the assembler
487 has to support. The fields are:
488 pseudo-op name without dot
489 function to call to execute this pseudo-op
490 Integer arg to pass to the function
492 const pseudo_typeS md_pseudo_table
[] = {
493 { "data1", s_data1
, 0 },
494 { "data2", s_data2
, 0 },
496 { "even", s_even
, 0 },
497 { "skip", s_space
, 0 },
498 { "proc", s_proc
, 0 },
500 { "align", s_align_bytes
, 0 },
506 /* #define isbyte(x) ((x)>=-128 && (x)<=127) */
507 /* #define isword(x) ((x)>=-32768 && (x)<=32767) */
509 #define issbyte(x) ((x)>=-128 && (x)<=127)
510 #define isubyte(x) ((x)>=0 && (x)<=255)
511 #define issword(x) ((x)>=-32768 && (x)<=32767)
512 #define isuword(x) ((x)>=0 && (x)<=65535)
514 #define isbyte(x) ((x)>=-128 && (x)<=255)
515 #define isword(x) ((x)>=-32768 && (x)<=65535)
516 #define islong(x) (1)
518 extern char *input_line_pointer
;
525 /* JF these tables here are for speed at the expense of size */
526 /* You can replace them with the #if 0 versions if you really
527 need space and don't mind it running a bit slower */
529 static char mklower_table
[256];
530 #define mklower(c) (mklower_table[(unsigned char)(c)])
531 static char notend_table
[256];
532 static char alt_notend_table
[256];
533 #define notend(s) ( !(notend_table[(unsigned char)(*s)] || (*s==':' &&\
534 alt_notend_table[(unsigned char)(s[1])])))
537 #define mklower(c) (isupper(c) ? tolower(c) : c)
541 /* JF modified this to handle cases where the first part of a symbol name
542 looks like a register */
545 * m68k_reg_parse() := if it looks like a register, return it's token &
546 * advance the pointer.
549 enum _register
m68k_reg_parse(ccp
)
554 if (isalpha(*start
) && is_name_beginner(*start
))
560 while (is_part_of_name(c
= *p
++))
563 symbolP
= symbol_find(start
);
566 if (symbolP
&& S_GET_SEGMENT(symbolP
) == SEG_REGISTER
)
569 return S_GET_VALUE(symbolP
);
577 #define SKIP_WHITE() { str++; if(*str==' ') str++;}
580 * m68k_ip_op := '#' + <anything>
581 * | <register> + range_sep + get_regs
584 * range_sep := '/' | '-' ;
586 * SKIP_WHITE := <empty> | ' ' ;
593 register struct m68k_op
*opP
;
601 } /* Find the beginning of the string */
604 opP
->error
="Missing operand";
608 for(strend
= str
; *strend
; strend
++) ;;
614 opP
->con1
=add_exp(str
,strend
);
617 } /* Guess what: A constant. Shar and enjoy */
619 i
= m68k_reg_parse(&str
);
621 /* is a register, is exactly a register, and is followed by '@' */
623 if((i
==FAIL
|| *str
!='\0') && *str
!='@') {
626 if(i
!=FAIL
&& (*str
=='/' || *str
=='-')) {
628 return(get_regs(i
,str
,opP
));
630 if ((stmp
=strchr(str
,'@')) != '\0') {
631 opP
->con1
=add_exp(str
,stmp
-1);
637 if ((current_architecture
& m68020up
) == 0) {
639 } /* if target is not a '20 or better */
642 if(*stmp
++!='(' || *strend
--!=')') {
643 opP
->error
="Malformed operand";
646 i
=try_index(&stmp
,opP
);
647 opP
->con2
=add_exp(stmp
,strend
);
655 } /* if there's an '@' */
657 opP
->con1
= add_exp(str
,strend
);
659 } /* not a register, not exactly a register, or no '@' */
664 if(i
>=DATA
+0 && i
<=DATA
+7)
666 else if(i
>=ADDR
+0 && i
<=ADDR
+7)
673 /* Can't indirect off non address regs, but Dx@ is OK for cas2 */
674 if((i
<ADDR
+0 || i
>ADDR
+7) && i
!=PC
&& i
!=ZPC
&& i
!=FAIL
675 && (str
[1] != '\0' || i
<DATA
+0 || i
>DATA
+7)) {
676 opP
->error
="Invalid indirect register";
684 if (i
< DATA
+ 0 || i
> DATA
+ 7)
699 opP
->error
="Junk after indirect";
702 /* Some kind of indexing involved. Lets find out how bad it is */
703 i
=try_index(&str
,opP
);
704 /* Didn't start with an index reg, maybe its offset or offset,reg */
712 opP
->error
="Missing )";
714 case ',': i
=0; break;
715 case '(': i
++; break;
716 case ')': --i
; break;
719 /* if(str[-3]==':') {
736 opP->error="Specified size isn't :w or :l";
739 opP->con1=add_exp(beg_str,str-4);
740 opP->con1->e_siz=siz;
742 opP
->con1
=add_exp(beg_str
,str
-2);
743 /* Should be offset,reg */
745 i
=try_index(&str
,opP
);
747 opP
->error
="Malformed index reg";
752 /* We've now got offset) offset,reg) or reg) */
755 /* Th-the-thats all folks */
756 if (opP
->reg
== FAIL
) opP
->mode
= AINDX
; /* Other form of indirect */
757 else if(opP
->ireg
== FAIL
) opP
->mode
= AOFF
;
758 else opP
->mode
= AINDX
;
761 /* Next thing had better be another @ */
773 if ((current_architecture
& m68020up
) == 0) {
775 } /* if target is not a '20 or better */
778 if(opP
->ireg
!= FAIL
) {
781 i
= try_index(&str
, opP
);
783 opP
->error
= "Two index registers! not allowed!";
787 i
= try_index(&str
, opP
);
799 opP
->error
="Missing )";
802 case ',': i
=0; break;
803 case '(': i
++; break;
804 case ')': --i
; break;
808 opP
->con2
=add_exp(beg_str
,str
-2);
810 if (str
[-1] == ',') {
811 if (opP
->ireg
!= FAIL
) {
812 opP
->error
= "Can't have two index regs";
816 i
= try_index(&str
, opP
);
819 opP
->error
= "malformed index reg";
824 } else if (opP
->ireg
!= FAIL
) {
834 opP
->error
="Junk after indirect";
842 * try_index := data_or_address_register + ')' + SKIP_W
843 * | data_or_address_register + ':' + SKIP_W + size_spec + SKIP_W + multiplier + ')' + SKIP_W
845 * multiplier := <empty>
846 * | ':' + multiplier_number
849 * multiplier_number := '1' | '2' | '4' | '8' ;
851 * size_spec := 'l' | 'L' | 'w' | 'W' ;
853 * SKIP_W := <empty> | ' ' ;
857 static int try_index(s
,opP
)
863 #define SKIP_W() { ss++; if (*ss==' ') ss++;}
867 i
=m68k_reg_parse(&ss
);
868 if(!(i
>=DATA
+0 && i
<=ADDR
+7)) { /* if i is not DATA or ADDR reg */
882 opP
->error
="Missing : in index register";
897 opP
->error
="Index register size spec not :w or :l";
909 if (cpu_of_arch(current_architecture
) < m68020
) {
910 opP
->error
="no index scaling in pre-68020's";
917 opP
->error
="index multiplier not 1, 2, 4 or 8";
924 opP
->error
="Missing )";
933 #ifdef TEST1 /* TEST1 tests m68k_ip_op(), which parses operands */
937 struct m68k_op thark
;
942 memset(&thark
, '\0', sizeof(thark
));
943 if(!m68k_ip_op(buf
,&thark
)) printf("FAIL:");
945 printf("op1 error %s in %s\n",thark
.error
,buf
);
946 printf("mode %d, reg %d, ",thark
.mode
,thark
.reg
);
948 printf("Constant: '%.*s',",1+thark
.e_const
-thark
.b_const
,thark
.b_const
);
949 printf("ireg %d, isiz %d, imul %d ",thark
.ireg
,thark
.isiz
,thark
.imul
);
951 printf("Iadd: '%.*s'",1+thark
.e_iadd
-thark
.b_iadd
,thark
.b_iadd
);
960 static struct hash_control
* op_hash
= NULL
; /* handle of the OPCODE hash table
961 NULL means any use before m68k_ip_begin()
968 * This converts a string into a 68k instruction.
969 * The string must be a bare single instruction in sun format
970 * with RMS-style 68020 indirects
973 * It provides some error messages: at most one fatal error message (which
974 * stops the scan) and at most one warning message for each operand.
975 * The 68k instruction is returned in exploded form, since we have no
976 * knowledge of how you parse (or evaluate) your expressions.
977 * We do however strip off and decode addressing modes and operation
980 * This function's value is a string. If it is not "" then an internal
981 * logic error was found: read this code to assign meaning to the string.
982 * No argument string should generate such an error string:
983 * it means a bug in our code, not in the user's text.
985 * You MUST have called m68k_ip_begin() once and m86_ip_end() never before using
989 /* JF this function no longer returns a useful value. Sorry */
990 void m68k_ip (instring
)
994 register struct m68k_op
*opP
;
995 register struct m68k_incant
*opcode
;
997 register int tmpreg
= 0, baseo
= 0, outro
= 0, nextword
;
1002 char *crack_operand();
1003 LITTLENUM_TYPE words
[6];
1004 LITTLENUM_TYPE
*wordp
;
1005 unsigned long ok_arch
= 0;
1007 if (*instring
== ' ')
1008 instring
++; /* skip leading whitespace */
1010 /* Scan up to end of operation-code, which MUST end in end-of-string
1011 or exactly 1 space. */
1012 for (p
= instring
; *p
!= '\0'; p
++)
1017 if (p
== instring
) {
1018 the_ins
.error
= "No operator";
1019 the_ins
.opcode
[0] = NULL
;
1020 /* the_ins.numo=1; */
1024 /* p now points to the end of the opcode name, probably whitespace.
1025 make sure the name is null terminated by clobbering the whitespace,
1026 look it up in the hash table, then fix it back. */
1029 opcode
= (struct m68k_incant
*)hash_find (op_hash
, instring
);
1032 if (opcode
== NULL
) {
1033 the_ins
.error
= "Unknown operator";
1034 the_ins
.opcode
[0] = NULL
;
1035 /* the_ins.numo=1; */
1039 /* found a legitimate opcode, start matching operands */
1040 while (*p
== ' ') ++p
;
1042 for(opP
= &the_ins
.operands
[0]; *p
; opP
++) {
1044 p
= crack_operand(p
, opP
);
1047 the_ins
.error
=opP
->error
;
1052 opsfound
= opP
- &the_ins
.operands
[0];
1054 /* This ugly hack is to support the floating pt opcodes in their standard form */
1055 /* Essentially, we fake a first enty of type COP#1 */
1056 if (opcode
->m_operands
[0]=='I') {
1059 for(n
=opsfound
;n
>0;--n
)
1060 the_ins
.operands
[n
]=the_ins
.operands
[n
-1];
1062 memset((char *)(&the_ins
.operands
[0]), '\0', sizeof(the_ins
.operands
[0]));
1063 the_ins
.operands
[0].mode
=MSCR
;
1064 the_ins
.operands
[0].reg
=COPNUM
; /* COP #1 */
1068 /* We've got the operands. Find an opcode that'll accept them */
1069 for (losing
= 0; ; ) {
1070 /* if we didn't get the right number of ops,
1071 or we have no common model with this pattern
1072 then reject this pattern. */
1074 if (opsfound
!= opcode
->m_opnum
1075 || ((opcode
->m_arch
& current_architecture
) == 0))
1078 ok_arch
|= opcode
->m_arch
;
1081 for (s
=opcode
->m_operands
, opP
= &the_ins
.operands
[0]; *s
&& !losing
; s
+= 2, opP
++) {
1082 /* Warning: this switch is huge! */
1083 /* I've tried to organize the cases into this order:
1084 non-alpha first, then alpha by letter. lower-case goes directly
1085 before uppercase counterpart. */
1086 /* Code with multiple case ...: gets sorted by the lowest case ...
1087 it belongs to. I hope this makes sense. */
1090 if (opP
->mode
== MSCR
|| opP
->mode
== IMMED
1091 || opP
->mode
== DREG
|| opP
->mode
== AREG
1092 || opP
->mode
== AINC
|| opP
->mode
== ADEC
1093 || opP
->mode
== REGLST
)
1098 if(opP
->mode
!=IMMED
)
1103 t
=get_num(opP
->con1
,80);
1104 if(s
[1]=='b' && !isbyte(t
))
1106 else if(s
[1]=='w' && !isword(t
))
1113 if(opP
->mode
!=IMMED
)
1118 if(opP
->mode
==MSCR
|| opP
->mode
==AREG
||
1119 opP
->mode
==IMMED
|| opP
->reg
==PC
|| opP
->reg
==ZPC
|| opP
->mode
==REGLST
)
1124 if(opP
->mode
==MSCR
|| opP
->reg
==PC
||
1125 opP
->reg
==ZPC
|| opP
->mode
==REGLST
)
1131 if(opP
->mode
==MSCR
|| opP
->mode
==DREG
||
1132 opP
->mode
==AREG
|| opP
->mode
==IMMED
|| opP
->reg
==PC
|| opP
->reg
==ZPC
||
1133 opP
->mode
==AINC
|| opP
->mode
==ADEC
|| opP
->mode
==REGLST
)
1138 if(opP
->mode
==MSCR
|| opP
->mode
==REGLST
)
1153 if(opP
->mode
==MSCR
|| opP
->mode
==AREG
||
1154 opP
->mode
==AINC
|| opP
->mode
==ADEC
|| opP
->mode
==IMMED
|| opP
->mode
==REGLST
)
1159 if(opP
->mode
==MSCR
|| opP
->mode
==AREG
|| opP
->mode
==REGLST
)
1164 if(opP
->mode
==MSCR
|| opP
->mode
==AREG
||
1165 opP
->mode
==AINC
|| opP
->mode
==ADEC
|| opP
->mode
==IMMED
|| opP
->reg
==PC
||
1166 opP
->reg
==ZPC
|| opP
->mode
==REGLST
)
1171 if(opP
->mode
==MSCR
|| opP
->mode
==AREG
||
1172 opP
->mode
==IMMED
|| opP
->mode
==REGLST
)
1176 case '~': /* For now! (JF FOO is this right?) */
1177 if(opP
->mode
==MSCR
|| opP
->mode
==DREG
||
1178 opP
->mode
==AREG
|| opP
->mode
==IMMED
|| opP
->reg
==PC
|| opP
->reg
==ZPC
|| opP
->mode
==REGLST
)
1183 if (opP
->mode
!= MSCR
|| (opP
->reg
!= TT0
&& opP
->reg
!= TT1
))
1192 if (opP
->mode
!= AINDR
) {
1194 } /* if not address register indirect */
1197 if(opP
->mode
!=ABSL
|| (flagseen
['S'] && instring
[0] == 'j'
1198 && instring
[1] == 'b'
1199 && instring
[2] == 's'
1200 && instring
[3] == 'r'))
1205 if(opP
->mode
!=MSCR
|| opP
->reg
!=CCR
)
1209 case 'd': /* FOO This mode is a KLUDGE!! */
1210 if(opP
->mode
!=AOFF
&& (opP
->mode
!=ABSL
||
1211 opP
->con1
->e_beg
[0]!='(' || opP
->con1
->e_end
[0]!=')'))
1221 if(opP
->mode
!=MSCR
|| opP
->reg
<(FPREG
+0) || opP
->reg
>(FPREG
+7))
1226 if(opP
->mode
!=MSCR
|| opP
->reg
<COPNUM
||
1232 if (opP
->mode
!= MSCR
1235 || cpu_of_arch(current_architecture
) < m68010
/* before 68010 had none */
1236 || (cpu_of_arch(current_architecture
) < m68020
1240 && opP
->reg
!= VBR
) /* 68010's had only these */
1241 || (cpu_of_arch(current_architecture
) < m68040
1249 && opP
->reg
!= ISP
) /* 680[23]0's have only these */
1250 || (cpu_of_arch(current_architecture
) == m68040
/* 68040 has all but this */
1251 && opP
->reg
== CAAR
)) {
1253 } /* doesn't cut it */
1257 if(opP
->mode
!=IMMED
)
1263 if(opP
->mode
==DREG
|| opP
->mode
==AREG
|| opP
->mode
==FPREG
) {
1268 opP
->reg
=1<<(opP
->reg
-DATA
);
1270 } else if(opP
->mode
!=REGLST
) {
1272 } else if(s
[1]=='8' && opP
->reg
&0x0FFffFF)
1274 else if(s
[1]=='3' && opP
->reg
&0x7000000)
1279 if(opP
->mode
!=IMMED
)
1284 t
=get_num(opP
->con1
,80);
1285 if(!issbyte(t
) || isvar(opP
->con1
))
1291 if(opP
->mode
!=DREG
&& opP
->mode
!=IMMED
)
1296 if(opP
->mode
!=IMMED
)
1301 t
=get_num(opP
->con1
,80);
1302 if(t
<1 || t
>8 || isvar(opP
->con1
))
1308 if(opP
->mode
!=DREG
&& opP
->mode
!=AREG
)
1313 if (opP
->mode
!=AINDR
&& opP
->mode
!=DINDR
)
1318 if(opP
->mode
!=MSCR
|| !(opP
->reg
==FPI
|| opP
->reg
==FPS
|| opP
->reg
==FPC
))
1323 if(opP
->mode
!=MSCR
|| opP
->reg
!=SR
)
1328 if (opP
->mode
!= IMMED
)
1332 long t
= get_num (opP
->con1
, 80);
1333 if (t
< 0 || t
> 7 || isvar (opP
->con1
))
1339 if(opP
->mode
!=MSCR
|| opP
->reg
!=USP
)
1343 /* JF these are out of order. We could put them
1344 in order if we were willing to put up with
1345 bunches of #ifdef m68851s in the code.
1347 Don't forget that you need these operands
1348 to use 68030 MMU instructions. */
1350 /* Memory addressing mode used by pflushr */
1352 if(opP
->mode
==MSCR
|| opP
->mode
==DREG
||
1353 opP
->mode
==AREG
|| opP
->mode
==REGLST
)
1358 if (opP
->mode
!= MSCR
|| (opP
->reg
!= SFC
&& opP
->reg
!= DFC
))
1363 if (opP
->mode
!= MSCR
1364 || (opP
->reg
!= TC
&& opP
->reg
!= CAL
1365 && opP
->reg
!= VAL
&& opP
->reg
!= SCC
&& opP
->reg
!= AC
))
1370 if (opP
->reg
!= VAL
)
1375 if (opP
->mode
!= MSCR
1376 || (opP
->reg
!= DRP
&& opP
->reg
!= SRP
1377 && opP
->reg
!= CRP
))
1382 if (opP
->mode
!= MSCR
||
1383 (!(opP
->reg
>= BAD
&& opP
->reg
<= BAD
+7) &&
1384 !(opP
->reg
>= BAC
&& opP
->reg
<= BAC
+7)))
1389 if (opP
->reg
!= PSR
)
1394 if (opP
->reg
!= PCSR
)
1402 && opP
->reg
!= BC
) {
1404 } /* not a cache specifier. */
1408 if (opP
->mode
!= ABSL
) {
1410 } /* not absolute */
1414 as_fatal("Internal error: Operand mode %c unknown in line %d of file \"%s\"",
1415 *s
, __LINE__
, __FILE__
);
1416 } /* switch on type of operand */
1420 } /* for each operand */
1421 } /* if immediately wrong */
1427 opcode
= opcode
->m_next
;
1431 && !(ok_arch
& current_architecture
))
1435 strcpy (buf
, "invalid instruction for this architecture; needs ");
1436 cp
= buf
+ strlen (buf
);
1440 strcpy (cp
, "fpu (68040 or 68881/68882)");
1443 strcpy (cp
, "mmu (68030 or 68851)");
1446 strcpy (cp
, "68020 or higher");
1449 strcpy (cp
, "68000 or higher");
1452 strcpy (cp
, "68010 or higher");
1456 int got_one
= 0, idx
;
1457 const static struct {
1458 enum m68k_architecture arch
;
1469 for (idx
= 0; idx
< sizeof (archs
)/sizeof (archs
[0]); idx
++)
1471 if (archs
[idx
].arch
& ok_arch
)
1475 strcpy (cp
, " or ");
1479 strcpy (cp
, archs
[idx
].name
);
1491 the_ins
.error
= "operands mismatch";
1493 } /* Fell off the end */
1498 /* now assemble it */
1500 the_ins
.args
=opcode
->m_operands
;
1501 the_ins
.numargs
=opcode
->m_opnum
;
1502 the_ins
.numo
=opcode
->m_codenum
;
1503 the_ins
.opcode
[0]=getone(opcode
);
1504 the_ins
.opcode
[1]=gettwo(opcode
);
1506 for (s
= the_ins
.args
, opP
= &the_ins
.operands
[0]; *s
; s
+= 2, opP
++) {
1507 /* This switch is a doozy.
1508 Watch the first step; its a big one! */
1526 tmpreg
=0x3c; /* 7.4 */
1527 if (strchr("bwl",s
[1])) nextword
=get_num(opP
->con1
,80);
1528 else nextword
=nextword
=get_num(opP
->con1
,0);
1529 if(isvar(opP
->con1
))
1530 add_fix(s
[1],opP
->con1
,0);
1533 if(!isbyte(nextword
))
1534 opP
->error
="operand out of range";
1539 if(!isword(nextword
))
1540 opP
->error
="operand out of range";
1545 addword(nextword
>>16);
1567 as_fatal("Internal error: Can't decode %c%c in line %s of file \"%s\"",
1568 *s
, s
[1], __LINE__
, __FILE__
);
1573 /* We gotta put out some float */
1574 if(seg(opP
->con1
)!=SEG_BIG
) {
1575 int_to_gen(nextword
);
1576 gen_to_words(words
,baseo
,(long int)outro
);
1577 for(wordp
=words
;baseo
--;wordp
++)
1581 if(offs(opP
->con1
)>0) {
1582 as_warn("Bignum assumed to be binary bit-pattern");
1583 if(offs(opP
->con1
)>baseo
) {
1584 as_warn("Bignum too big for %c format; truncated",s
[1]);
1585 offs(opP
->con1
)=baseo
;
1587 baseo
-=offs(opP
->con1
);
1588 for(wordp
=generic_bignum
+offs(opP
->con1
)-1;offs(opP
->con1
)--;--wordp
)
1594 gen_to_words(words
,baseo
,(long)outro
);
1595 for (wordp
=words
;baseo
--;wordp
++)
1599 tmpreg
=opP
->reg
-DATA
; /* 0.dreg */
1602 tmpreg
=0x08+opP
->reg
-ADDR
; /* 1.areg */
1605 tmpreg
=0x10+opP
->reg
-ADDR
; /* 2.areg */
1608 tmpreg
=0x20+opP
->reg
-ADDR
; /* 4.areg */
1611 tmpreg
=0x18+opP
->reg
-ADDR
; /* 3.areg */
1615 nextword
=get_num(opP
->con1
,80);
1616 /* Force into index mode. Hope this works */
1618 /* We do the first bit for 32-bit displacements,
1619 and the second bit for 16 bit ones. It is
1620 possible that we should make the default be
1621 WORD instead of LONG, but I think that'd
1622 break GCC, so we put up with a little
1623 inefficiency for the sake of working output.
1626 if( !issword(nextword
)
1627 || ( isvar(opP
->con1
)
1628 && ( ( opP
->con1
->e_siz
==0
1629 && flagseen
['l']==0)
1630 || opP
->con1
->e_siz
==3))) {
1633 tmpreg
=0x3B; /* 7.3 */
1635 tmpreg
=0x30+opP
->reg
-ADDR
; /* 6.areg */
1636 if(isvar(opP
->con1
)) {
1638 add_frag(adds(opP
->con1
),
1640 TAB(PCLEA
,SZ_UNDEF
));
1644 add_fix('l',opP
->con1
,1);
1648 addword(nextword
>>16);
1651 tmpreg
=0x3A; /* 7.2 */
1653 tmpreg
=0x28+opP
->reg
-ADDR
; /* 5.areg */
1655 if(isvar(opP
->con1
)) {
1657 add_fix('w',opP
->con1
,1);
1659 add_fix('w',opP
->con1
,0);
1668 know(current_architecture
& m68020up
);
1669 /* intentional fall-through */
1672 baseo
=get_num(opP
->con1
,80);
1673 outro
=get_num(opP
->con2
,80);
1674 /* Figure out the 'addressing mode' */
1675 /* Also turn on the BASE_DISABLE bit, if needed */
1676 if(opP
->reg
==PC
|| opP
->reg
==ZPC
) {
1677 tmpreg
=0x3b; /* 7.3 */
1680 } else if(opP
->reg
==FAIL
) {
1682 tmpreg
=0x30; /* 6.garbage */
1683 } else tmpreg
=0x30+opP
->reg
-ADDR
; /* 6.areg */
1685 siz1
= (opP
->con1
) ? opP
->con1
->e_siz
: 0;
1686 siz2
= (opP
->con2
) ? opP
->con2
->e_siz
: 0;
1688 /* Index register stuff */
1689 if(opP
->ireg
>=DATA
+0 && opP
->ireg
<=ADDR
+7) {
1690 nextword
|=(opP
->ireg
-DATA
)<<12;
1692 if(opP
->isiz
==0 || opP
->isiz
==3)
1696 case 2: nextword
|=0x200; break;
1697 case 4: nextword
|=0x400; break;
1698 case 8: nextword
|=0x600; break;
1699 default: as_fatal("failed sanity check.");
1702 GET US OUT OF HERE! */
1704 /* Must be INDEX, with an index
1705 register. Address register
1706 cannot be ZERO-PC, and either
1707 :b was forced, or we know
1709 if( opP
->mode
==AINDX
1714 && !isvar(opP
->con1
)))) {
1715 nextword
+=baseo
&0xff;
1717 if(isvar(opP
->con1
))
1718 add_fix('B',opP
->con1
,0);
1722 nextword
|=0x40; /* No index reg */
1724 /* It aint simple */
1726 /* If the guy specified a width, we assume that
1727 it is wide enough. Maybe it isn't. If so, we lose
1731 if(isvar(opP
->con1
) || !issword(baseo
)) {
1742 as_warn("Byte dispacement won't work. Defaulting to :w");
1751 /* Figure out innner displacement stuff */
1752 if(opP
->mode
!=AINDX
) {
1755 if(isvar(opP
->con2
) || !issword(outro
)) {
1766 as_warn("Byte dispacement won't work. Defaulting to :w");
1774 if(opP
->mode
==APODX
) nextword
|=0x04;
1775 else if(opP
->mode
==AMIND
) nextword
|=0x40;
1779 if(isvar(opP
->con1
)) {
1780 if(opP
->reg
==PC
|| opP
->reg
==ZPC
) {
1781 add_fix(siz1
==3 ? 'l' : 'w',opP
->con1
,1);
1782 opP
->con1
->e_exp
.X_add_number
+=6;
1784 add_fix(siz1
==3 ? 'l' : 'w',opP
->con1
,0);
1791 if(isvar(opP
->con2
)) {
1792 if(opP
->reg
==PC
|| opP
->reg
==ZPC
) {
1793 add_fix(siz2
==3 ? 'l' : 'w',opP
->con2
,1);
1794 opP
->con1
->e_exp
.X_add_number
+=6;
1796 add_fix(siz2
==3 ? 'l' : 'w',opP
->con2
,0);
1806 nextword
=get_num(opP
->con1
,80);
1807 switch(opP
->con1
->e_siz
) {
1809 as_warn("Unknown size for absolute reference");
1811 if(!isvar(opP
->con1
) && issword(offs(opP
->con1
))) {
1812 tmpreg
=0x38; /* 7.0 */
1816 /* Don't generate pc relative code
1817 on 68010 and 68000 */
1820 && seg(opP
->con1
) == SEG_TEXT
1821 && now_seg
== SEG_TEXT
1822 && cpu_of_arch(current_architecture
) >= m68020
1824 && !strchr("~%&$?", s
[0])) {
1825 tmpreg
=0x3A; /* 7.2 */
1826 add_frag(adds(opP
->con1
),
1828 TAB(PCREL
,SZ_UNDEF
));
1831 case 3: /* Fall through into long */
1832 if(isvar(opP
->con1
))
1833 add_fix('l',opP
->con1
,0);
1835 tmpreg
=0x39; /* 7.1 mode */
1836 addword(nextword
>>16);
1841 if(isvar(opP
->con1
))
1842 add_fix('w',opP
->con1
,0);
1844 tmpreg
=0x38; /* 7.0 mode */
1850 as_bad("invalid indirect register");
1854 as_bad("unknown/incorrect operand");
1857 install_gen_operand(s
[1],tmpreg
);
1862 switch(s
[1]) { /* JF: I hate floating point! */
1877 tmpreg
=get_num(opP
->con1
,tmpreg
);
1878 if(isvar(opP
->con1
))
1879 add_fix(s
[1],opP
->con1
,0);
1881 case 'b': /* Danger: These do no check for
1882 certain types of overflow.
1885 opP
->error
="out of range";
1887 if(isvar(opP
->con1
))
1888 the_ins
.reloc
[the_ins
.nrel
-1].n
=(opcode
->m_codenum
)*2;
1892 opP
->error
="out of range";
1894 if(isvar(opP
->con1
))
1895 the_ins
.reloc
[the_ins
.nrel
-1].n
=(opcode
->m_codenum
)*2;
1898 insop(tmpreg
); /* Because of the way insop works, we put these two out backwards */
1900 if(isvar(opP
->con1
))
1901 the_ins
.reloc
[the_ins
.nrel
-1].n
=(opcode
->m_codenum
)*2;
1907 install_operand(s
[1],tmpreg
);
1910 as_fatal("Internal error: Unknown mode #%c in line %s of file \"%s\"", s
[1], __LINE__
, __FILE__
);
1918 install_operand(s
[1],opP
->reg
-ADDR
);
1922 tmpreg
=get_num(opP
->con1
,80);
1925 /* Needs no offsetting */
1926 add_fix('B',opP
->con1
,1);
1929 /* Offset the displacement to be relative to byte disp location */
1930 opP
->con1
->e_exp
.X_add_number
+=2;
1931 add_fix('w',opP
->con1
,1);
1936 if (cpu_of_arch(current_architecture
) < m68020
) /* 68000 or 010 */
1937 as_warn("Can't use long branches on 68000/68010");
1938 the_ins
.opcode
[the_ins
.numo
-1]|=0xff;
1939 /* Offset the displacement to be relative to byte disp location */
1940 opP
->con1
->e_exp
.X_add_number
+=4;
1941 add_fix('l',opP
->con1
,1);
1946 if(subs(opP
->con1
)) /* We can't relax it */
1949 /* This could either be a symbol, or an
1950 absolute address. No matter, the
1951 frag hacking will finger it out.
1952 Not quite: it can't switch from
1953 BRANCH to BCC68000 for the case
1954 where opnd is absolute (it needs
1955 to use the 68000 hack since no
1956 conditional abs jumps). */
1957 if (((cpu_of_arch(current_architecture
) < m68020
) || (0==adds(opP
->con1
)))
1958 && (the_ins
.opcode
[0] >= 0x6200)
1959 && (the_ins
.opcode
[0] <= 0x6f00)) {
1960 add_frag(adds(opP
->con1
),offs(opP
->con1
),TAB(BCC68000
,SZ_UNDEF
));
1962 add_frag(adds(opP
->con1
),offs(opP
->con1
),TAB(BRANCH
,SZ_UNDEF
));
1966 if(isvar(opP
->con1
)) {
1967 /* check for DBcc instruction */
1968 if ((the_ins
.opcode
[0] & 0xf0f8) ==0x50c8) {
1969 /* size varies if patch */
1970 /* needed for long form */
1971 add_frag(adds(opP
->con1
),offs(opP
->con1
),TAB(DBCC
,SZ_UNDEF
));
1976 opP
->con1
->e_exp
.X_add_number
+=2;
1977 add_fix('w',opP
->con1
,1);
1981 case 'C': /* Fixed size LONG coproc branches */
1982 the_ins
.opcode
[the_ins
.numo
-1]|=0x40;
1983 /* Offset the displacement to be relative to byte disp location */
1984 /* Coproc branches don't have a byte disp option, but they are
1985 compatible with the ordinary branches, which do... */
1986 opP
->con1
->e_exp
.X_add_number
+=4;
1987 add_fix('l',opP
->con1
,1);
1991 case 'c': /* Var size Coprocesssor branches */
1992 if(subs(opP
->con1
)) {
1993 add_fix('l',opP
->con1
,1);
1994 add_frag((symbolS
*)0,(long)0,TAB(FBRANCH
,LONG
));
1995 } else if(adds(opP
->con1
)) {
1996 add_frag(adds(opP
->con1
),offs(opP
->con1
),TAB(FBRANCH
,SZ_UNDEF
));
1998 /* add_frag((symbolS *)0,offs(opP->con1),TAB(FBRANCH,SHORT)); */
1999 the_ins
.opcode
[the_ins
.numo
-1]|=0x40;
2000 add_fix('l',opP
->con1
,1);
2006 as_fatal("Internal error: operand type B%c unknown in line %s of file \"%s\"",
2007 s
[1], __LINE__
, __FILE__
);
2011 case 'C': /* Ignore it */
2014 case 'd': /* JF this is a kludge */
2015 if(opP
->mode
==AOFF
) {
2016 install_operand('s',opP
->reg
-ADDR
);
2020 tmpP
=opP
->con1
->e_end
-2;
2022 opP
->con1
->e_end
-=4; /* point to the , */
2023 baseo
=m68k_reg_parse(&tmpP
);
2024 if(baseo
<ADDR
+0 || baseo
>ADDR
+7) {
2025 as_bad("Unknown address reg, using A0");
2028 install_operand('s',baseo
);
2030 tmpreg
=get_num(opP
->con1
,80);
2031 if(!issword(tmpreg
)) {
2032 as_warn("Expression out of range, using 0");
2039 install_operand(s
[1],opP
->reg
-DATA
);
2043 install_operand(s
[1],opP
->reg
-FPREG
);
2047 tmpreg
=1+opP
->reg
-COPNUM
;
2050 install_operand(s
[1],tmpreg
);
2053 case 'J': /* JF foo */
2055 case SFC
: tmpreg
=0x000; break;
2056 case DFC
: tmpreg
=0x001; break;
2057 case CACR
: tmpreg
=0x002; break;
2058 case TC
: tmpreg
=0x003; break;
2059 case ITT0
: tmpreg
=0x004; break;
2060 case ITT1
: tmpreg
=0x005; break;
2061 case DTT0
: tmpreg
=0x006; break;
2062 case DTT1
: tmpreg
=0x007; break;
2064 case USP
: tmpreg
=0x800; break;
2065 case VBR
: tmpreg
=0x801; break;
2066 case CAAR
: tmpreg
=0x802; break;
2067 case MSP
: tmpreg
=0x803; break;
2068 case ISP
: tmpreg
=0x804; break;
2069 case MMUSR
: tmpreg
=0x805; break;
2070 case URP
: tmpreg
=0x806; break;
2071 case SRP
: tmpreg
=0x807; break;
2073 as_fatal("failed sanity check.");
2075 install_operand(s
[1],tmpreg
);
2079 tmpreg
=get_num(opP
->con1
,55);
2080 install_operand(s
[1],tmpreg
&0x7f);
2086 if(tmpreg
&0x7FF0000)
2087 as_bad("Floating point register in register list");
2088 insop(reverse_16_bits(tmpreg
));
2090 if(tmpreg
&0x700FFFF)
2091 as_bad("Wrong register in floating-point reglist");
2092 install_operand(s
[1],reverse_8_bits(tmpreg
>>16));
2099 if(tmpreg
&0x7FF0000)
2100 as_bad("Floating point register in register list");
2102 } else if(s
[1]=='8') {
2103 if(tmpreg
&0x0FFFFFF)
2104 as_bad("incorrect register in reglist");
2105 install_operand(s
[1],tmpreg
>>24);
2107 if(tmpreg
&0x700FFFF)
2108 as_bad("wrong register in floating-point reglist");
2110 install_operand(s
[1],tmpreg
>>16);
2115 install_operand(s
[1],get_num(opP
->con1
,60));
2119 tmpreg
= (opP
->mode
==DREG
)
2120 ? 0x20+opP
->reg
-DATA
2121 : (get_num(opP
->con1
,40)&0x1F);
2122 install_operand(s
[1],tmpreg
);
2126 tmpreg
=get_num(opP
->con1
,10);
2129 install_operand(s
[1],tmpreg
);
2134 /* This depends on the fact that ADDR registers are
2135 eight more than their corresponding DATA regs, so
2136 the result will have the ADDR_REG bit set */
2137 install_operand(s
[1],opP
->reg
-DATA
);
2141 if(opP
->reg
==FPI
) tmpreg
=0x1;
2142 else if(opP
->reg
==FPS
) tmpreg
=0x2;
2143 else if(opP
->reg
==FPC
) tmpreg
=0x4;
2144 else as_fatal("failed sanity check.");
2145 install_operand(s
[1],tmpreg
);
2148 case 'S': /* Ignore it */
2152 install_operand(s
[1],get_num(opP
->con1
,30));
2155 case 'U': /* Ignore it */
2160 case NC
: tmpreg
= 0; break;
2161 case DC
: tmpreg
= 1; break;
2162 case IC
: tmpreg
= 2; break;
2163 case BC
: tmpreg
= 3; break;
2165 as_fatal("failed sanity check");
2166 } /* switch on cache token */
2167 install_operand(s
[1], tmpreg
);
2170 /* JF: These are out of order, I fear. */
2180 as_fatal("failed sanity check.");
2182 install_operand(s
[1],tmpreg
);
2203 as_fatal("failed sanity check.");
2205 install_operand(s
[1],tmpreg
);
2209 if (opP
->reg
== VAL
)
2211 as_fatal("failed sanity check.");
2226 as_fatal("failed sanity check.");
2228 install_operand(s
[1],tmpreg
);
2233 case BAD
: case BAD
+1: case BAD
+2: case BAD
+3:
2234 case BAD
+4: case BAD
+5: case BAD
+6: case BAD
+7:
2235 tmpreg
= (4 << 10) | ((opP
->reg
- BAD
) << 2);
2238 case BAC
: case BAC
+1: case BAC
+2: case BAC
+3:
2239 case BAC
+4: case BAC
+5: case BAC
+6: case BAC
+7:
2240 tmpreg
= (5 << 10) | ((opP
->reg
- BAC
) << 2);
2244 as_fatal("failed sanity check.");
2246 install_operand(s
[1], tmpreg
);
2249 know(opP
->reg
== PSR
);
2252 know(opP
->reg
== PCSR
);
2265 as_fatal ("failed sanity check");
2267 install_operand (s
[1], tmpreg
);
2270 tmpreg
= get_num (opP
->con1
, 20);
2271 install_operand (s
[1], tmpreg
);
2273 case '_': /* used only for move16 absolute 32-bit address */
2274 tmpreg
=get_num(opP
->con1
,80);
2275 addword (tmpreg
>> 16);
2276 addword (tmpreg
& 0xFFFF);
2279 as_fatal("Internal error: Operand type %c unknown in line %d of file \"%s\"",
2280 s
[0], __LINE__
, __FILE__
);
2283 /* By the time whe get here (FINALLY) the_ins contains the complete
2284 instruction, ready to be emitted. . . */
2288 * get_regs := '/' + ?
2289 * | '-' + <register>
2290 * | '-' + <register> + ?
2295 * The idea here must be to scan in a set of registers but I don't
2296 * understand it. Looks awfully sloppy to me but I don't have any doc on
2303 static int get_regs(i
,str
,opP
)
2305 struct m68k_op
*opP
;
2308 /* 26, 25, 24, 23-16, 15-8, 0-7 */
2309 /* Low order 24 bits encoded fpc,fps,fpi,fp7-fp0,a7-a0,d7-d0 */
2310 unsigned long cur_regs
= 0;
2314 #define ADD_REG(x) { if(x==FPI) cur_regs|=(1<<24);\
2315 else if(x==FPS) cur_regs|=(1<<25);\
2316 else if(x==FPC) cur_regs|=(1<<26);\
2317 else cur_regs|=(1<<(x-1)); }
2324 } else if(*str
=='-') {
2326 reg2
=m68k_reg_parse(&str
);
2327 if(reg2
<DATA
|| reg2
>=FPREG
+8 || reg1
==FPI
|| reg1
==FPS
|| reg1
==FPC
) {
2328 opP
->error
="unknown register in register list";
2337 } else if(*str
=='\0') {
2341 opP
->error
="unknow character in register list";
2344 /* DJA -- Bug Fix. Did't handle d1-d2/a1 until the following instruction was added */
2347 reg1
=m68k_reg_parse(&str
);
2348 if((reg1
<DATA
|| reg1
>=FPREG
+8) && !(reg1
==FPI
|| reg1
==FPS
|| reg1
==FPC
)) {
2349 opP
->error
="unknown register in register list";
2357 static int reverse_16_bits(in
)
2363 static int mask
[16] = {
2364 0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,
2365 0x0100,0x0200,0x0400,0x0800,0x1000,0x2000,0x4000,0x8000
2372 } /* reverse_16_bits() */
2374 static int reverse_8_bits(in
)
2380 static int mask
[8] = {
2381 0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,
2389 } /* reverse_8_bits() */
2391 static void install_operand(mode
,val
)
2397 the_ins
.opcode
[0]|=val
& 0xFF; /* JF FF is for M kludge */
2400 the_ins
.opcode
[0]|=val
<<9;
2403 the_ins
.opcode
[1]|=val
<<12;
2406 the_ins
.opcode
[1]|=val
<<6;
2409 the_ins
.opcode
[1]|=val
;
2412 the_ins
.opcode
[2]|=val
<<12;
2415 the_ins
.opcode
[2]|=val
<<6;
2418 /* DANGER! This is a hack to force cas2l and cas2w cmds
2419 to be three words long! */
2421 the_ins
.opcode
[2]|=val
;
2424 the_ins
.opcode
[1]|=val
<<7;
2427 the_ins
.opcode
[1]|=val
<<10;
2431 the_ins
.opcode
[1]|=val
<<5;
2436 the_ins
.opcode
[1]|=(val
<<10)|(val
<<7);
2439 the_ins
.opcode
[1]|=(val
<<12)|val
;
2442 the_ins
.opcode
[0]|=val
=0xff;
2445 the_ins
.opcode
[0]|=val
<<9;
2448 the_ins
.opcode
[1]|=val
;
2451 the_ins
.opcode
[1]|=val
;
2452 the_ins
.numo
++; /* What a hack */
2455 the_ins
.opcode
[1]|=val
<<4;
2462 the_ins
.opcode
[0] |= (val
<< 6);
2465 the_ins
.opcode
[1] = (val
>> 16);
2466 the_ins
.opcode
[2] = val
& 0xffff;
2470 as_fatal("failed sanity check.");
2472 } /* install_operand() */
2474 static void install_gen_operand(mode
,val
)
2480 the_ins
.opcode
[0]|=val
;
2483 /* This is a kludge!!! */
2484 the_ins
.opcode
[0]|=(val
&0x07)<<9|(val
&0x38)<<3;
2493 the_ins
.opcode
[0]|=val
;
2495 /* more stuff goes here */
2497 as_fatal("failed sanity check.");
2499 } /* install_gen_operand() */
2502 * verify that we have some number of paren pairs, do m68k_ip_op(), and
2503 * then deal with the bitfield hack.
2506 static char *crack_operand(str
,opP
)
2508 register struct m68k_op
*opP
;
2510 register int parens
;
2512 register char *beg_str
;
2518 for(parens
=0;*str
&& (parens
>0 || notend(str
));str
++) {
2519 if(*str
=='(') parens
++;
2520 else if(*str
==')') {
2521 if(!parens
) { /* ERROR */
2522 opP
->error
="Extra )";
2528 if(!*str
&& parens
) { /* ERROR */
2529 opP
->error
="Missing )";
2534 if(m68k_ip_op(beg_str
,opP
)==FAIL
) {
2540 c
= *++str
; /* JF bitfield hack */
2544 as_bad("Missing operand");
2549 /* See the comment up above where the #define notend(... is */
2554 if(*s
==',') return 0;
2555 if(*s
=='{' || *s
=='}')
2557 if(*s
!=':') return 1;
2558 /* This kludge here is for the division cmd, which is a kludge */
2559 if(index("aAdD#",s
[1])) return 0;
2564 /* This is the guts of the machine-dependent assembler. STR points to a
2565 machine dependent instruction. This function is supposed to emit
2566 the frags/bytes it assembles to.
2570 insert_reg(regname
, regnum
)
2576 symbol_table_insert(symbol_new(regname
, SEG_REGISTER
, regnum
, &zero_address_frag
));
2578 for (i
= 0; regname
[i
]; i
++)
2579 buf
[i
] = islower (regname
[i
]) ? toupper (regname
[i
]) : regname
[i
];
2582 symbol_table_insert(symbol_new(buf
, SEG_REGISTER
, regnum
, &zero_address_frag
));
2585 static const struct {
2689 /* 68ec030 versions of same */
2692 /* 68ec030 access control unit, identical to 030 MMU status reg */
2704 for (i
= 0; init_table
[i
].name
; i
++)
2705 insert_reg(init_table
[i
].name
, init_table
[i
].number
);
2718 int shorts_this_frag
;
2719 static int done_first_time
;
2721 if (!done_first_time
)
2723 done_first_time
= 1;
2725 if (cpu_of_arch (current_architecture
) == 0)
2727 enum m68k_architecture cpu_type
;
2732 if (strcmp (TARGET_CPU
, "m68000") == 0)
2734 else if (strcmp (TARGET_CPU
, "m68010") == 0)
2736 else if (strcmp (TARGET_CPU
, "m68020") == 0
2737 || strcmp (TARGET_CPU
, "m68k") == 0)
2739 else if (strcmp (TARGET_CPU
, "m68030") == 0)
2741 else if (strcmp (TARGET_CPU
, "m68040") == 0)
2747 /* If float or mmu were specified, just default cpu. */
2748 if (current_architecture
!= 0)
2749 current_architecture
|= cpu_type
;
2752 if ((cpu_type
& m68020up
) != 0)
2753 current_architecture
= (cpu_type
2762 current_architecture
= cpu_type
;
2765 if (cpu_of_arch (current_architecture
) == m68000
2766 && (current_architecture
& m68881
) != 0)
2768 as_bad ("incompatible processors 68000 and 68881 specified");
2770 done_first_time
= 1;
2773 memset((char *)(&the_ins
), '\0', sizeof(the_ins
)); /* JF for paranoia sake */
2777 for(n
=the_ins
.numargs
;n
;--n
)
2778 if(the_ins
.operands
[n
].error
) {
2779 er
=the_ins
.operands
[n
].error
;
2784 as_bad("%s -- statement `%s' ignored",er
,str
);
2788 if(the_ins
.nfrag
==0) { /* No frag hacking involved; just put it out */
2789 toP
=frag_more(2*the_ins
.numo
);
2790 fromP
= &the_ins
.opcode
[0];
2791 for(m
=the_ins
.numo
;m
;--m
) {
2792 md_number_to_chars(toP
,(long)(*fromP
),2);
2796 /* put out symbol-dependent info */
2797 for(m
=0;m
<the_ins
.nrel
;m
++) {
2798 switch(the_ins
.reloc
[m
].wid
) {
2815 as_fatal("Don't know how to figure width of %c in md_assemble()",the_ins
.reloc
[m
].wid
);
2819 (toP
-frag_now
->fr_literal
)-the_ins
.numo
*2+the_ins
.reloc
[m
].n
,
2821 the_ins
.reloc
[m
].add
,
2822 the_ins
.reloc
[m
].sub
,
2823 the_ins
.reloc
[m
].off
,
2824 the_ins
.reloc
[m
].pcrel
,
2830 /* There's some frag hacking */
2831 for(n
=0,fromP
= &the_ins
.opcode
[0];n
<the_ins
.nfrag
;n
++) {
2834 if(n
==0) wid
=2*the_ins
.fragb
[n
].fragoff
;
2835 else wid
=2*(the_ins
.numo
-the_ins
.fragb
[n
-1].fragoff
);
2839 for(m
=wid
/2;m
;--m
) {
2840 md_number_to_chars(toP
,(long)(*fromP
),2);
2845 for(m
=0;m
<the_ins
.nrel
;m
++) {
2846 if((the_ins
.reloc
[m
].n
)>= 2*shorts_this_frag
/* 2*the_ins.fragb[n].fragoff */) {
2847 the_ins
.reloc
[m
].n
-= 2*shorts_this_frag
/* 2*the_ins.fragb[n].fragoff */;
2850 wid
=the_ins
.reloc
[m
].wid
;
2853 the_ins
.reloc
[m
].wid
=0;
2854 wid
= (wid
=='b') ? 1 : (wid
=='w') ? 2 : (wid
=='l') ? 4 : 4000;
2857 (toP
-frag_now
->fr_literal
)-the_ins
.numo
*2+the_ins
.reloc
[m
].n
,
2859 the_ins
.reloc
[m
].add
,
2860 the_ins
.reloc
[m
].sub
,
2861 the_ins
.reloc
[m
].off
,
2862 the_ins
.reloc
[m
].pcrel
,
2865 /* know(the_ins.fragb[n].fadd); */
2866 (void)frag_var(rs_machine_dependent
,10,0,(relax_substateT
)(the_ins
.fragb
[n
].fragty
),
2867 the_ins
.fragb
[n
].fadd
,the_ins
.fragb
[n
].foff
,to_beg_P
);
2869 n
=(the_ins
.numo
-the_ins
.fragb
[n
-1].fragoff
);
2872 toP
=frag_more(n
*sizeof(short));
2874 md_number_to_chars(toP
,(long)(*fromP
),2);
2880 for(m
=0;m
<the_ins
.nrel
;m
++) {
2883 wid
=the_ins
.reloc
[m
].wid
;
2886 the_ins
.reloc
[m
].wid
=0;
2887 wid
= (wid
=='b') ? 1 : (wid
=='w') ? 2 : (wid
=='l') ? 4 : 4000;
2890 (the_ins
.reloc
[m
].n
+ toP
-frag_now
->fr_literal
)-/* the_ins.numo */ shorts_this_frag
*2,
2892 the_ins
.reloc
[m
].add
,
2893 the_ins
.reloc
[m
].sub
,
2894 the_ins
.reloc
[m
].off
,
2895 the_ins
.reloc
[m
].pcrel
,
2908 * md_begin -- set up hash tables with 68000 instructions.
2909 * similar to what the vax assembler does. ---phr
2911 /* RMS claims the thing to do is take the m68k-opcode.h table, and make
2912 a copy of it at runtime, adding in the information we want but isn't
2913 there. I think it'd be better to have an awk script hack the table
2914 at compile time. Or even just xstr the table and use it as-is. But
2915 my lord ghod hath spoken, so we do it this way. Excuse the ugly var
2918 register const struct m68k_opcode
*ins
;
2919 register struct m68k_incant
*hack
,
2921 register char *retval
= 0; /* empty string, or error msg text */
2922 register unsigned int i
;
2925 if ((op_hash
= hash_new()) == NULL
)
2926 as_fatal("Virtual memory exhausted");
2928 obstack_begin(&robyn
,4000);
2929 for (ins
= m68k_opcodes
; ins
< endop
; ins
++) {
2930 hack
=slak
=(struct m68k_incant
*)obstack_alloc(&robyn
,sizeof(struct m68k_incant
));
2932 /* we *could* ignore insns that don't match our
2933 arch here but just leaving them out of the
2935 slak
->m_operands
=ins
->args
;
2936 slak
->m_opnum
=strlen(slak
->m_operands
)/2;
2937 slak
->m_arch
= ins
->arch
;
2938 slak
->m_opcode
=ins
->opcode
;
2939 /* This is kludgey */
2940 slak
->m_codenum
=((ins
->match
)&0xffffL
) ? 2 : 1;
2941 if((ins
+1)!=endop
&& !strcmp(ins
->name
,(ins
+1)->name
)) {
2942 slak
->m_next
=(struct m68k_incant
*) obstack_alloc(&robyn
,sizeof(struct m68k_incant
));
2949 retval
= hash_insert (op_hash
, ins
->name
,(char *)hack
);
2950 /* Didn't his mommy tell him about null pointers? */
2951 if(retval
&& *retval
)
2952 as_fatal("Internal Error: Can't hash %s: %s",ins
->name
,retval
);
2955 for (i
= 0; i
< sizeof(mklower_table
) ; i
++)
2956 mklower_table
[i
] = (isupper(c
= (char) i
)) ? tolower(c
) : c
;
2958 for (i
= 0 ; i
< sizeof(notend_table
) ; i
++) {
2959 notend_table
[i
] = 0;
2960 alt_notend_table
[i
] = 0;
2962 notend_table
[','] = 1;
2963 notend_table
['{'] = 1;
2964 notend_table
['}'] = 1;
2965 alt_notend_table
['a'] = 1;
2966 alt_notend_table
['A'] = 1;
2967 alt_notend_table
['d'] = 1;
2968 alt_notend_table
['D'] = 1;
2969 alt_notend_table
['#'] = 1;
2970 alt_notend_table
['f'] = 1;
2971 alt_notend_table
['F'] = 1;
2972 #ifdef REGISTER_PREFIX
2973 alt_notend_table
[REGISTER_PREFIX
] = 1;
2980 #define notend(s) ((*s == ',' || *s == '}' || *s == '{' \
2981 || (*s == ':' && strchr("aAdD#", s[1]))) \
2985 /* This funciton is called once, before the assembler exits. It is
2986 supposed to do any final cleanup for this part of the assembler.
2993 /* Equal to MAX_PRECISION in atof-ieee.c */
2994 #define MAX_LITTLENUMS 6
2996 /* Turn a string in input_line_pointer into a floating point constant of type
2997 type, and store the appropriate bytes in *litP. The number of LITTLENUMS
2998 emitted is stored in *sizeP . An error message is returned, or NULL on OK.
3001 md_atof(type
,litP
,sizeP
)
3007 LITTLENUM_TYPE words
[MAX_LITTLENUMS
];
3008 LITTLENUM_TYPE
*wordP
;
3039 return "Bad call to MD_ATOF()";
3041 t
=atof_ieee(input_line_pointer
,type
,words
);
3043 input_line_pointer
=t
;
3045 *sizeP
=prec
* sizeof(LITTLENUM_TYPE
);
3046 for(wordP
=words
;prec
--;) {
3047 md_number_to_chars(litP
,(long)(*wordP
++),sizeof(LITTLENUM_TYPE
));
3048 litP
+=sizeof(LITTLENUM_TYPE
);
3050 return ""; /* Someone should teach Dean about null pointers */
3053 /* Turn an integer of n bytes (in val) into a stream of bytes appropriate
3054 for use in the a.out file, and stores them in the array pointed to by buf.
3055 This knows about the endian-ness of the target machine and does
3056 THE RIGHT THING, whatever it is. Possible values for n are 1 (byte)
3057 2 (short) and 4 (long) Floating numbers are put out as a series of
3058 LITTLENUMS (shorts, here at least)
3061 md_number_to_chars(buf
,val
,n
)
3081 as_fatal("failed sanity check.");
3086 md_apply_fix(fixP
, val
)
3090 char *buf
= fixP
->fx_where
+ fixP
->fx_frag
->fr_literal
;
3092 switch(fixP
->fx_size
) {
3107 BAD_CASE (fixP
->fx_size
);
3112 /* *fragP has been relaxed to its final size, and now needs to have
3113 the bytes inside it modified to conform to the new size There is UGLY
3117 md_convert_frag(headers
, fragP
)
3118 object_headers
*headers
;
3119 register fragS
*fragP
;
3124 /* Address in object code of the displacement. */
3125 register int object_address
= fragP
-> fr_fix
+ fragP
-> fr_address
;
3127 #ifdef IBM_COMPILER_SUX
3128 /* This is wrong but it convinces the native rs6000 compiler to
3129 generate the code we want. */
3130 register char *buffer_address
= fragP
-> fr_literal
;
3131 buffer_address
+= fragP
-> fr_fix
;
3132 #else /* IBM_COMPILER_SUX */
3133 /* Address in gas core of the place to store the displacement. */
3134 register char *buffer_address
= fragP
->fr_fix
+ fragP
->fr_literal
;
3135 #endif /* IBM_COMPILER_SUX */
3137 /* No longer true: know(fragP->fr_symbol); */
3139 /* The displacement of the address, from current location. */
3140 disp
= fragP
->fr_symbol
? S_GET_VALUE(fragP
->fr_symbol
) : 0;
3141 disp
= (disp
+ fragP
->fr_offset
) - object_address
;
3143 switch(fragP
->fr_subtype
) {
3144 case TAB(BCC68000
,BYTE
):
3145 case TAB(BRANCH
,BYTE
):
3146 know(issbyte(disp
));
3148 as_bad("short branch with zero offset: use :w");
3149 fragP
->fr_opcode
[1]=disp
;
3152 case TAB(DBCC
,SHORT
):
3153 know(issword(disp
));
3156 case TAB(BCC68000
,SHORT
):
3157 case TAB(BRANCH
,SHORT
):
3158 know(issword(disp
));
3159 fragP
->fr_opcode
[1]=0x00;
3162 case TAB(BRANCH
,LONG
):
3163 if (cpu_of_arch(current_architecture
) < m68020
) {
3164 if (fragP
->fr_opcode
[0]==0x61) {
3165 fragP
->fr_opcode
[0]= 0x4E;
3166 fragP
->fr_opcode
[1]= 0xB9; /* JBSR with ABSL LONG offset */
3167 subseg_change(SEG_TEXT
, 0);
3180 } else if (fragP
->fr_opcode
[0]==0x60) {
3181 fragP
->fr_opcode
[0]= 0x4E;
3182 fragP
->fr_opcode
[1]= 0xF9; /* JMP with ABSL LONG offset */
3183 subseg_change(SEG_TEXT
, 0);
3184 fix_new(fragP
, fragP
->fr_fix
, 4, fragP
->fr_symbol
, 0, fragP
->fr_offset
,0,
3189 as_bad("Long branch offset not supported.");
3192 fragP
->fr_opcode
[1]=0xff;
3196 case TAB(BCC68000
,LONG
):
3197 /* only Bcc 68000 instructions can come here */
3198 /* change bcc into b!cc/jmp absl long */
3199 fragP
->fr_opcode
[0] ^= 0x01; /* invert bcc */
3200 fragP
->fr_opcode
[1] = 0x6; /* branch offset = 6 */
3202 /* JF: these used to be fr_opcode[2,3], but they may be in a
3203 different frag, in which case refering to them is a no-no.
3204 Only fr_opcode[0,1] are guaranteed to work. */
3205 *buffer_address
++ = 0x4e; /* put in jmp long (0x4ef9) */
3206 *buffer_address
++ = 0xf9;
3207 fragP
->fr_fix
+= 2; /* account for jmp instruction */
3208 subseg_change(SEG_TEXT
,0);
3209 fix_new(fragP
, fragP
->fr_fix
, 4, fragP
->fr_symbol
, 0,
3215 case TAB(DBCC
,LONG
):
3216 /* only DBcc 68000 instructions can come here */
3217 /* change dbcc into dbcc/jmp absl long */
3218 /* JF: these used to be fr_opcode[2-7], but that's wrong */
3219 *buffer_address
++ = 0x00; /* branch offset = 4 */
3220 *buffer_address
++ = 0x04;
3221 *buffer_address
++ = 0x60; /* put in bra pc+6 */
3222 *buffer_address
++ = 0x06;
3223 *buffer_address
++ = 0x4e; /* put in jmp long (0x4ef9) */
3224 *buffer_address
++ = 0xf9;
3226 fragP
->fr_fix
+= 6; /* account for bra/jmp instructions */
3227 subseg_change(SEG_TEXT
,0);
3228 fix_new(fragP
, fragP
->fr_fix
, 4, fragP
->fr_symbol
, 0,
3234 case TAB(FBRANCH
,SHORT
):
3235 know((fragP
->fr_opcode
[1]&0x40)==0);
3238 case TAB(FBRANCH
,LONG
):
3239 fragP
->fr_opcode
[1]|=0x40; /* Turn on LONG bit */
3242 case TAB(PCREL
,SHORT
):
3245 case TAB(PCREL
,LONG
):
3246 /* The thing to do here is force it to ABSOLUTE LONG, since
3247 PCREL is really trying to shorten an ABSOLUTE address anyway */
3248 /* JF FOO This code has not been tested */
3249 subseg_change(SEG_TEXT
,0);
3250 fix_new(fragP
, fragP
->fr_fix
, 4, fragP
->fr_symbol
, 0, fragP
->fr_offset
, 0, NO_RELOC
);
3251 if((fragP
->fr_opcode
[1] & 0x3F) != 0x3A)
3252 as_bad("Internal error (long PC-relative operand) for insn 0x%04lx at 0x%lx",
3253 fragP
->fr_opcode
[0],fragP
->fr_address
);
3254 fragP
->fr_opcode
[1]&= ~0x3F;
3255 fragP
->fr_opcode
[1]|=0x39; /* Mode 7.1 */
3257 /* md_number_to_chars(buffer_address,
3258 (long)(fragP->fr_symbol->sy_value + fragP->fr_offset),
3262 case TAB(PCLEA
,SHORT
):
3263 subseg_change(SEG_TEXT
,0);
3264 fix_new(fragP
,(int)(fragP
->fr_fix
),2,fragP
->fr_symbol
,(symbolS
*)0,fragP
->fr_offset
,1,
3266 fragP
->fr_opcode
[1] &= ~0x3F;
3267 fragP
->fr_opcode
[1] |= 0x3A;
3270 case TAB(PCLEA
,LONG
):
3271 subseg_change(SEG_TEXT
,0);
3272 fix_new(fragP
,(int)(fragP
->fr_fix
)+2,4,fragP
->fr_symbol
,(symbolS
*)0,fragP
->fr_offset
+2,1,
3274 *buffer_address
++ = 0x01;
3275 *buffer_address
++ = 0x70;
3277 /* buffer_address+=2; */
3281 } /* switch on subtype */
3284 md_number_to_chars(buffer_address
, (long) disp
, (int) ext
);
3285 fragP
->fr_fix
+= ext
;
3286 /* H_SET_TEXT_SIZE(headers, H_GET_TEXT_SIZE(headers) + ext); */
3287 } /* if extending */
3290 } /* md_convert_frag() */
3292 /* Force truly undefined symbols to their maximum size, and generally set up
3293 the frag list to be relaxed
3295 int md_estimate_size_before_relax(fragP
, segment
)
3296 register fragS
*fragP
;
3300 register char *buffer_address
= fragP
->fr_fix
+ fragP
->fr_literal
;
3302 old_fix
= fragP
->fr_fix
;
3304 /* handle SZ_UNDEF first, it can be changed to BYTE or SHORT */
3305 switch (fragP
->fr_subtype
) {
3307 case TAB(BRANCH
,SZ_UNDEF
): {
3308 if((fragP
->fr_symbol
!= NULL
) /* Not absolute */
3309 && S_GET_SEGMENT(fragP
->fr_symbol
) == segment
) {
3310 fragP
->fr_subtype
=TAB(TABTYPE(fragP
->fr_subtype
),BYTE
);
3312 } else if((fragP
->fr_symbol
== 0) || (cpu_of_arch(current_architecture
) < m68020
)) {
3313 /* On 68000, or for absolute value, switch to abs long */
3314 /* FIXME, we should check abs val, pick short or long */
3315 if(fragP
->fr_opcode
[0]==0x61) {
3316 fragP
->fr_opcode
[0]= 0x4E;
3317 fragP
->fr_opcode
[1]= 0xB9; /* JBSR with ABSL LONG offset */
3318 subseg_change(SEG_TEXT
, 0);
3319 fix_new(fragP
, fragP
->fr_fix
, 4,
3320 fragP
->fr_symbol
, 0, fragP
->fr_offset
, 0, NO_RELOC
);
3323 } else if(fragP
->fr_opcode
[0]==0x60) {
3324 fragP
->fr_opcode
[0]= 0x4E;
3325 fragP
->fr_opcode
[1]= 0xF9; /* JMP with ABSL LONG offset */
3326 subseg_change(SEG_TEXT
, 0);
3327 fix_new(fragP
, fragP
->fr_fix
, 4,
3328 fragP
->fr_symbol
, 0, fragP
->fr_offset
, 0, NO_RELOC
);
3332 as_warn("Long branch offset to extern symbol not supported.");
3334 } else { /* Symbol is still undefined. Make it simple */
3335 fix_new(fragP
, (int)(fragP
->fr_fix
), 4, fragP
->fr_symbol
,
3336 (symbolS
*)0, fragP
->fr_offset
+4, 1, NO_RELOC
);
3338 fragP
->fr_opcode
[1]=0xff;
3344 } /* case TAB(BRANCH,SZ_UNDEF) */
3346 case TAB(FBRANCH
,SZ_UNDEF
): {
3347 if(S_GET_SEGMENT(fragP
->fr_symbol
) == segment
|| flagseen
['l']) {
3348 fragP
->fr_subtype
= TAB(FBRANCH
,SHORT
);
3351 fragP
->fr_subtype
= TAB(FBRANCH
,LONG
);
3355 } /* TAB(FBRANCH,SZ_UNDEF) */
3357 case TAB(PCREL
,SZ_UNDEF
): {
3358 if(S_GET_SEGMENT(fragP
->fr_symbol
) == segment
|| flagseen
['l']) {
3359 fragP
->fr_subtype
= TAB(PCREL
,SHORT
);
3362 fragP
->fr_subtype
= TAB(PCREL
,LONG
);
3366 } /* TAB(PCREL,SZ_UNDEF) */
3368 case TAB(BCC68000
,SZ_UNDEF
): {
3369 if((fragP
->fr_symbol
!= NULL
)
3370 && S_GET_SEGMENT(fragP
->fr_symbol
) == segment
) {
3371 fragP
->fr_subtype
=TAB(BCC68000
,BYTE
);
3374 /* only Bcc 68000 instructions can come here */
3375 /* change bcc into b!cc/jmp absl long */
3376 fragP
->fr_opcode
[0] ^= 0x01; /* invert bcc */
3378 fragP
->fr_opcode
[1] = 0x04; /* branch offset = 6 */
3379 /* JF: these were fr_opcode[2,3] */
3380 buffer_address
[0] = 0x4e; /* put in jmp long (0x4ef9) */
3381 buffer_address
[1] = 0xf8;
3382 fragP
->fr_fix
+= 2; /* account for jmp instruction */
3383 subseg_change(SEG_TEXT
,0);
3384 fix_new(fragP
, fragP
->fr_fix
, 2, fragP
->fr_symbol
, 0,
3385 fragP
->fr_offset
, 0, NO_RELOC
);
3388 fragP
->fr_opcode
[1] = 0x06; /* branch offset = 6 */
3389 /* JF: these were fr_opcode[2,3] */
3390 buffer_address
[0] = 0x4e; /* put in jmp long (0x4ef9) */
3391 buffer_address
[1] = 0xf9;
3392 fragP
->fr_fix
+= 2; /* account for jmp instruction */
3393 subseg_change(SEG_TEXT
,0);
3394 fix_new(fragP
, fragP
->fr_fix
, 4, fragP
->fr_symbol
, 0,
3395 fragP
->fr_offset
, 0, NO_RELOC
);
3400 } /* case TAB(BCC68000,SZ_UNDEF) */
3402 case TAB(DBCC
,SZ_UNDEF
): {
3403 if (fragP
->fr_symbol
!= NULL
&& S_GET_SEGMENT(fragP
->fr_symbol
) == segment
) {
3404 fragP
->fr_subtype
=TAB(DBCC
,SHORT
);
3408 /* only DBcc 68000 instructions can come here */
3409 /* change dbcc into dbcc/jmp absl long */
3410 /* JF: these used to be fr_opcode[2-4], which is wrong. */
3411 buffer_address
[0] = 0x00; /* branch offset = 4 */
3412 buffer_address
[1] = 0x04;
3413 buffer_address
[2] = 0x60; /* put in bra pc + ... */
3416 /* JF: these were fr_opcode[5-7] */
3417 buffer_address
[3] = 0x04; /* plus 4 */
3418 buffer_address
[4] = 0x4e;/* Put in Jump Word */
3419 buffer_address
[5] = 0xf8;
3420 fragP
->fr_fix
+= 6; /* account for bra/jmp instruction */
3421 subseg_change(SEG_TEXT
,0);
3422 fix_new(fragP
, fragP
->fr_fix
, 2, fragP
->fr_symbol
, 0,
3425 fragP
->fr_offset
, 0, NO_RELOC
);
3428 /* JF: these were fr_opcode[5-7] */
3429 buffer_address
[3] = 0x06; /* Plus 6 */
3430 buffer_address
[4] = 0x4e; /* put in jmp long (0x4ef9) */
3431 buffer_address
[5] = 0xf9;
3432 fragP
->fr_fix
+= 6; /* account for bra/jmp instruction */
3433 subseg_change(SEG_TEXT
,0);
3434 fix_new(fragP
, fragP
->fr_fix
, 4, fragP
->fr_symbol
, 0,
3435 fragP
->fr_offset
, 0, NO_RELOC
);
3441 } /* case TAB(DBCC,SZ_UNDEF) */
3443 case TAB(PCLEA
,SZ_UNDEF
): {
3444 if ((S_GET_SEGMENT(fragP
->fr_symbol
))==segment
|| flagseen
['l']) {
3445 fragP
->fr_subtype
=TAB(PCLEA
,SHORT
);
3448 fragP
->fr_subtype
=TAB(PCLEA
,LONG
);
3452 } /* TAB(PCLEA,SZ_UNDEF) */
3457 } /* switch on subtype looking for SZ_UNDEF's. */
3459 /* now that SZ_UNDEF are taken care of, check others */
3460 switch (fragP
->fr_subtype
) {
3461 case TAB(BCC68000
,BYTE
):
3462 case TAB(BRANCH
,BYTE
):
3463 /* We can't do a short jump to the next instruction,
3464 so we force word mode. */
3465 if (fragP
->fr_symbol
&& S_GET_VALUE(fragP
->fr_symbol
)==0 &&
3466 fragP
->fr_symbol
->sy_frag
==fragP
->fr_next
) {
3467 fragP
->fr_subtype
=TAB(TABTYPE(fragP
->fr_subtype
),SHORT
);
3474 return fragP
->fr_var
+ fragP
->fr_fix
- old_fix
;
3477 #if defined(OBJ_AOUT) | defined(OBJ_BOUT)
3478 /* the bit-field entries in the relocation_info struct plays hell
3479 with the byte-order problems of cross-assembly. So as a hack,
3480 I added this mach. dependent ri twiddler. Ugly, but it gets
3482 /* on m68k: first 4 bytes are normal unsigned long, next three bytes
3483 are symbolnum, most sig. byte first. Last byte is broken up with
3484 bit 7 as pcrel, bits 6 & 5 as length, bit 4 as pcrel, and the lower
3485 nibble as nuthin. (on Sun 3 at least) */
3486 /* Translate the internal relocation information into target-specific
3490 md_ri_to_chars(the_bytes
, ri
)
3492 struct reloc_info_generic
*ri
;
3495 md_number_to_chars(the_bytes
, ri
->r_address
, 4);
3496 /* now the fun stuff */
3497 the_bytes
[4] = (ri
->r_symbolnum
>> 16) & 0x0ff;
3498 the_bytes
[5] = (ri
->r_symbolnum
>> 8) & 0x0ff;
3499 the_bytes
[6] = ri
->r_symbolnum
& 0x0ff;
3500 the_bytes
[7] = (((ri
->r_pcrel
<< 7) & 0x80) | ((ri
->r_length
<< 5) & 0x60) |
3501 ((ri
->r_extern
<< 4) & 0x10));
3503 #endif /* comment */
3505 void tc_aout_fix_to_chars(where
, fixP
, segment_address_in_file
)
3508 relax_addressT segment_address_in_file
;
3511 * In: length of relocation (or of address) in chars: 1, 2 or 4.
3512 * Out: GNU LD relocation length code: 0, 1, or 2.
3515 static unsigned char nbytes_r_length
[] = { 42, 0, 1, 42, 2 };
3518 know(fixP
->fx_addsy
!= NULL
);
3520 md_number_to_chars(where
,
3521 fixP
->fx_frag
->fr_address
+ fixP
->fx_where
- segment_address_in_file
,
3524 r_symbolnum
= (S_IS_DEFINED(fixP
->fx_addsy
)
3525 ? S_GET_TYPE(fixP
->fx_addsy
)
3526 : fixP
->fx_addsy
->sy_number
);
3528 where
[4] = (r_symbolnum
>> 16) & 0x0ff;
3529 where
[5] = (r_symbolnum
>> 8) & 0x0ff;
3530 where
[6] = r_symbolnum
& 0x0ff;
3531 where
[7] = (((fixP
->fx_pcrel
<< 7) & 0x80) | ((nbytes_r_length
[fixP
->fx_size
] << 5) & 0x60) |
3532 (((!S_IS_DEFINED(fixP
->fx_addsy
)) << 4) & 0x10));
3535 } /* tc_aout_fix_to_chars() */
3537 #endif /* OBJ_AOUT or OBJ_BOUT */
3539 #ifndef WORKING_DOT_WORD
3540 const int md_short_jump_size
= 4;
3541 const int md_long_jump_size
= 6;
3544 md_create_short_jump(ptr
,from_addr
,to_addr
,frag
,to_symbol
)
3553 offset
= to_addr
- (from_addr
+2);
3555 md_number_to_chars(ptr
,(long)0x6000,2);
3556 md_number_to_chars(ptr
+2,(long)offset
,2);
3560 md_create_long_jump(ptr
,from_addr
,to_addr
,frag
,to_symbol
)
3569 if (cpu_of_arch(current_architecture
) < m68020
) {
3570 offset
=to_addr
-S_GET_VALUE(to_symbol
);
3571 md_number_to_chars(ptr
,(long)0x4EF9,2);
3572 md_number_to_chars(ptr
+2,(long)offset
,4);
3573 fix_new(frag
,(ptr
+2)-frag
->fr_literal
,4,to_symbol
,(symbolS
*)0,(long)0,0,
3576 offset
=to_addr
- (from_addr
+2);
3577 md_number_to_chars(ptr
,(long)0x60ff,2);
3578 md_number_to_chars(ptr
+2,(long)offset
,4);
3583 /* Different values of OK tell what its OK to return. Things that aren't OK are an error (what a shock, no?)
3586 10: Absolute 1:8 only
3587 20: Absolute 0:7 only
3588 30: absolute 0:15 only
3589 40: Absolute 0:31 only
3590 50: absolute 0:127 only
3591 55: absolute -64:63 only
3592 60: absolute -128:127 only
3593 70: absolute 0:4095 only
3598 static int get_num(exp
,ok
)
3599 struct m68k_exp
*exp
;
3607 if(*exp
->e_beg
=='0') {
3608 if(exp
->e_beg
[1]=='x')
3609 sscanf(exp
->e_beg
+2,"%x",&l
);
3611 sscanf(exp
->e_beg
+1,"%O",&l
);
3614 return atol(exp
->e_beg
);
3620 /* Can't do anything */
3623 if(!exp
->e_beg
|| !exp
->e_end
) {
3624 seg(exp
)=SEG_ABSOLUTE
;
3627 offs(exp
)= (ok
==10) ? 1 : 0;
3628 as_warn("Null expression defaults to %ld",offs(exp
));
3633 if(/* ok!=80 && */exp
->e_end
[-1]==':' && (exp
->e_end
-exp
->e_beg
)>=2) {
3634 switch(exp
->e_end
[0]) {
3650 as_bad("Unknown size for expression \"%c\"",exp
->e_end
[0]);
3654 c_save
=exp
->e_end
[1];
3656 save_in
=input_line_pointer
;
3657 input_line_pointer
=exp
->e_beg
;
3658 switch(expression(&(exp
->e_exp
))) {
3660 seg(exp
)=SEG_ABSOLUTE
;
3663 offs(exp
)= (ok
==10) ? 1 : 0;
3664 as_warn("Unknown expression: '%s' defaulting to %d",exp
->e_beg
,offs(exp
));
3668 /* Do the same thing the VAX asm does */
3669 seg(exp
)=SEG_ABSOLUTE
;
3674 as_warn("expression out of range: defaulting to 1");
3681 if(offs(exp
)<1 || offs(exp
)>8) {
3682 as_warn("expression out of range: defaulting to 1");
3687 if(offs(exp
)<0 || offs(exp
)>7)
3691 if(offs(exp
)<0 || offs(exp
)>15)
3695 if(offs(exp
)<0 || offs(exp
)>32)
3699 if(offs(exp
)<0 || offs(exp
)>127)
3703 if(offs(exp
)<-64 || offs(exp
)>63)
3707 if(offs(exp
)<-128 || offs(exp
)>127)
3711 if(offs(exp
)<0 || offs(exp
)>4095) {
3713 as_warn("expression out of range: defaulting to 0");
3725 case SEG_DIFFERENCE
:
3726 if(ok
>=10 && ok
<=70) {
3727 seg(exp
)=SEG_ABSOLUTE
;
3730 offs(exp
)= (ok
==10) ? 1 : 0;
3731 as_warn("Can't deal with expression \"%s\": defaulting to %ld",exp
->e_beg
,offs(exp
));
3735 if (offs (exp
) < 0 /* flonum */
3736 && (ok
== 80 /* no bignums */
3737 || (ok
> 10 /* small-int ranges including 0 ok */
3738 /* If we have a flonum zero, a zero integer should
3739 do as well (e.g., in moveq). */
3740 && generic_floating_point_number
.exponent
== 0
3741 && generic_floating_point_number
.low
[0] == 0)))
3743 /* HACK! Turn it into a long */
3744 LITTLENUM_TYPE words
[6];
3746 gen_to_words(words
,2,8L);/* These numbers are magic! */
3747 seg(exp
)=SEG_ABSOLUTE
;
3750 offs(exp
)=words
[1]|(words
[0]<<16);
3753 seg(exp
)=SEG_ABSOLUTE
;
3756 offs(exp
)= (ok
==10) ? 1 : 0;
3757 as_warn("Can't deal with expression \"%s\": defaulting to %ld",exp
->e_beg
,offs(exp
));
3761 as_fatal("failed sanity check.");
3763 if(input_line_pointer
!=exp
->e_end
+1)
3764 as_bad("Ignoring junk after expression");
3765 exp
->e_end
[1]=c_save
;
3766 input_line_pointer
=save_in
;
3768 switch(exp
->e_siz
) {
3770 if(!isbyte(offs(exp
)))
3771 as_warn("expression doesn't fit in BYTE");
3774 if(!isword(offs(exp
)))
3775 as_warn("expression doesn't fit in WORD");
3783 /* These are the back-ends for the various machine dependent pseudo-ops. */
3784 void demand_empty_rest_of_line(); /* Hate those extra verbose names */
3786 static void s_data1() {
3787 subseg_new(SEG_DATA
,1);
3788 demand_empty_rest_of_line();
3791 static void s_data2() {
3792 subseg_new(SEG_DATA
,2);
3793 demand_empty_rest_of_line();
3798 /* We don't support putting frags in the BSS segment, we fake it
3799 by marking in_bss, then looking at s_skip for clues */
3801 subseg_new(SEG_BSS
, 0);
3802 demand_empty_rest_of_line();
3805 static void s_even() {
3807 register long temp_fill
;
3809 temp
= 1; /* JF should be 2? */
3810 temp_fill
= get_absolute_expression ();
3811 if ( ! need_pass_2
) /* Never make frag if expect extra pass. */
3812 frag_align (temp
, (int)temp_fill
);
3813 demand_empty_rest_of_line();
3816 static void s_proc() {
3817 demand_empty_rest_of_line();
3820 /* s_space is defined in read.c .skip is simply an alias to it. */
3824 * Invocation line includes a switch not recognized by the base assembler.
3825 * See if it's a processor-specific option. These are:
3827 * -[A]m[c]68000, -[A]m[c]68008, -[A]m[c]68010, -[A]m[c]68020, -[A]m[c]68030, -[A]m[c]68040
3828 * -[A]m[c]68881, -[A]m[c]68882, -[A]m[c]68851
3829 * Select the architecture. Instructions or features not
3830 * supported by the selected architecture cause fatal
3831 * errors. More than one may be specified. The default is
3832 * -m68020 -m68851 -m68881. Note that -m68008 is a synonym
3833 * for -m68000, and -m68882 is a synonym for -m68881.
3835 * MAYBE_FLOAT_TOO is defined below so that specifying a processor type
3836 * (e.g. m68020) also requests that float instructions be included. This
3837 * is the default setup, mostly to avoid hassling users. A better
3838 * rearrangement of this structure would be to add an option to DENY
3839 * floating point opcodes, for people who want to really know there's none
3840 * of that funny floaty stuff going on. FIXME-later.
3842 #ifndef MAYBE_FLOAT_TOO
3843 #define MAYBE_FLOAT_TOO m68881
3846 int md_parse_option(argP
,cntP
,vecP
)
3852 case 'l': /* -l means keep external to 2 bit offset
3853 rather than 16 bit one */
3856 case 'S': /* -S means that jbsr's always turn into jsr's. */
3861 /* intentional fall-through */
3867 } /* allow an optional "c" */
3869 if (!strcmp(*argP
, "68000")
3870 || !strcmp(*argP
, "68008")) {
3871 current_architecture
|= m68000
;
3872 } else if (!strcmp(*argP
, "68010")) {
3874 omagic
= 1<<16|OMAGIC
;
3876 current_architecture
|= m68010
;
3878 } else if (!strcmp(*argP
, "68020")) {
3879 current_architecture
|= m68020
| MAYBE_FLOAT_TOO
;
3881 } else if (!strcmp(*argP
, "68030")) {
3882 current_architecture
|= m68030
| MAYBE_FLOAT_TOO
;
3884 } else if (!strcmp(*argP
, "68040")) {
3885 current_architecture
|= m68040
| MAYBE_FLOAT_TOO
;
3888 } else if (!strcmp(*argP
, "68881")) {
3889 current_architecture
|= m68881
;
3891 } else if (!strcmp(*argP
, "68882")) {
3892 current_architecture
|= m68882
;
3894 #endif /* NO_68881 */
3896 } else if (!strcmp(*argP
,"68851")) {
3897 current_architecture
|= m68851
;
3899 #endif /* NO_68851 */
3901 as_warn("Unknown architecture, \"%s\". option ignored", *argP
);
3902 } /* switch on architecture */
3904 while(**argP
) (*argP
)++;
3909 if (!strcmp(*argP
,"pic")) {
3911 break; /* -pic, Position Independent Code */
3925 /* TEST2: Test md_assemble() */
3926 /* Warning, this routine probably doesn't work anymore */
3930 struct m68k_it the_ins
;
3937 if(!gets(buf
) || !*buf
)
3939 if(buf
[0]=='|' || buf
[1]=='.')
3941 for(cp
=buf
;*cp
;cp
++)
3946 memset(&the_ins
, '\0', sizeof(the_ins
));
3947 m68k_ip(&the_ins
,buf
);
3949 printf("Error %s in %s\n",the_ins
.error
,buf
);
3951 printf("Opcode(%d.%s): ",the_ins
.numo
,the_ins
.args
);
3952 for(n
=0;n
<the_ins
.numo
;n
++)
3953 printf(" 0x%x",the_ins
.opcode
[n
]&0xffff);
3955 print_the_insn(&the_ins
.opcode
[0],stdout
);
3956 (void)putchar('\n');
3958 for(n
=0;n
<strlen(the_ins
.args
)/2;n
++) {
3959 if(the_ins
.operands
[n
].error
) {
3960 printf("op%d Error %s in %s\n",n
,the_ins
.operands
[n
].error
,buf
);
3963 printf("mode %d, reg %d, ",the_ins
.operands
[n
].mode
,the_ins
.operands
[n
].reg
);
3964 if(the_ins
.operands
[n
].b_const
)
3965 printf("Constant: '%.*s', ",1+the_ins
.operands
[n
].e_const
-the_ins
.operands
[n
].b_const
,the_ins
.operands
[n
].b_const
);
3966 printf("ireg %d, isiz %d, imul %d, ",the_ins
.operands
[n
].ireg
,the_ins
.operands
[n
].isiz
,the_ins
.operands
[n
].imul
);
3967 if(the_ins
.operands
[n
].b_iadd
)
3968 printf("Iadd: '%.*s',",1+the_ins
.operands
[n
].e_iadd
-the_ins
.operands
[n
].b_iadd
,the_ins
.operands
[n
].b_iadd
);
3969 (void)putchar('\n');
3981 while(*str
&& *str
!=' ')
3983 if(str
[-1]==':' || str
[1]=='=')
3990 /* Possible states for relaxation:
3992 0 0 branch offset byte (bra, etc)
3996 1 0 indexed offsets byte a0@(32,d4:w:1) etc
4000 2 0 two-offset index word-word a0@(32,d4)@(45) etc
4019 extern fragS
*text_frag_root
;
4021 for(fragP
=text_frag_root
;fragP
;fragP
=fragP
->fr_next
) {
4022 printf("addr %lu next 0x%x fix %ld var %ld symbol 0x%x offset %ld\n",
4023 fragP
->fr_address
,fragP
->fr_next
,fragP
->fr_fix
,fragP
->fr_var
,fragP
->fr_symbol
,fragP
->fr_offset
);
4024 printf("opcode 0x%x type %d subtype %d\n\n",fragP
->fr_opcode
,fragP
->fr_type
,fragP
->fr_subtype
);
4036 fputs("Internal error:",stderr
);
4037 _doprnt(format
,&args
,stderr
);
4038 (void)putc('\n',stderr
);
4044 /* We have no need to default values of symbols. */
4048 md_undefined_symbol (name
)
4054 /* Parse an operand that is machine-specific.
4055 We just return without modifying the expression if we have nothing
4060 md_operand (expressionP
)
4061 expressionS
*expressionP
;
4065 /* Round up a section size to the appropriate boundary. */
4067 md_section_align (segment
, size
)
4071 return size
; /* Byte alignment is fine */
4074 /* Exactly what point is a PC-relative offset relative TO?
4075 On the 68k, they're relative to the address of the offset, plus
4076 its size. (??? Is this right? FIXME-SOON!) */
4078 md_pcrel_from (fixP
)
4081 return(fixP
->fx_size
+ fixP
->fx_where
+ fixP
->fx_frag
->fr_address
);
4091 /* end of tc-m68k.c */