1 /* tc-pdp11.c - pdp11-specific -
2 Copyright 2001, 2002, 2004, 2005, 2007, 2009
3 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler.
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to
19 the Free Software Foundation, 51 Franklin Street - Fifth Floor,
20 Boston, MA 02110-1301, USA. */
23 #include "safe-ctype.h"
24 #include "opcode/pdp11.h"
26 extern int flonum_gen2vax (int, FLONUM_TYPE
* f
, LITTLENUM_TYPE
*);
31 /* A representation for PDP-11 machine code. */
36 int additional
; /* Is there an additional word? */
37 int word
; /* Additional word, if any. */
40 bfd_reloc_code_real_type type
;
46 /* Instruction set extensions.
48 If you change this from an array to something else, please update
49 the "PDP-11 instruction set extensions" comment in pdp11.h. */
50 int pdp11_extension
[PDP11_EXT_NUM
];
52 /* Assembly options. */
57 int asm_option
[ASM_OPT_NUM
];
59 /* These chars start a comment anywhere in a source file (except inside
61 const char comment_chars
[] = "#/";
63 /* These chars only start a comment at the beginning of a line. */
64 const char line_comment_chars
[] = "#/";
66 const char line_separator_chars
[] = ";";
68 /* Chars that can be used to separate mant from exp in floating point nums. */
69 const char EXP_CHARS
[] = "eE";
71 /* Chars that mean this number is a floating point constant. */
72 /* as in 0f123.456. */
73 /* or 0H1.234E-12 (see exp chars above). */
74 const char FLT_CHARS
[] = "dDfF";
76 void pseudo_even (int);
77 void pseudo_bss (int);
79 const pseudo_typeS md_pseudo_table
[] =
81 { "bss", pseudo_bss
, 0 },
82 { "even", pseudo_even
, 0 },
86 static struct hash_control
*insn_hash
= NULL
;
89 set_option (char *arg
)
93 if (strcmp (arg
, "all-extensions") == 0
94 || strcmp (arg
, "all") == 0)
96 memset (pdp11_extension
, ~0, sizeof pdp11_extension
);
97 pdp11_extension
[PDP11_NONE
] = 0;
100 else if (strcmp (arg
, "no-extensions") == 0)
102 memset (pdp11_extension
, 0, sizeof pdp11_extension
);
103 pdp11_extension
[PDP11_BASIC
] = 1;
107 if (strncmp (arg
, "no-", 3) == 0)
113 /* Commersial instructions. */
114 if (strcmp (arg
, "cis") == 0)
115 pdp11_extension
[PDP11_CIS
] = yes
;
116 /* Call supervisor mode. */
117 else if (strcmp (arg
, "csm") == 0)
118 pdp11_extension
[PDP11_CSM
] = yes
;
119 /* Extended instruction set. */
120 else if (strcmp (arg
, "eis") == 0)
121 pdp11_extension
[PDP11_EIS
] = pdp11_extension
[PDP11_LEIS
] = yes
;
122 /* KEV11 floating-point. */
123 else if (strcmp (arg
, "fis") == 0
124 || strcmp (arg
, "kev11") == 0
125 || strcmp (arg
, "kev-11") == 0)
126 pdp11_extension
[PDP11_FIS
] = yes
;
127 /* FP-11 floating-point. */
128 else if (strcmp (arg
, "fpp") == 0
129 || strcmp (arg
, "fpu") == 0
130 || strcmp (arg
, "fp11") == 0
131 || strcmp (arg
, "fp-11") == 0
132 || strcmp (arg
, "fpj11") == 0
133 || strcmp (arg
, "fp-j11") == 0
134 || strcmp (arg
, "fpj-11") == 0)
135 pdp11_extension
[PDP11_FPP
] = yes
;
136 /* Limited extended insns. */
137 else if (strcmp (arg
, "limited-eis") == 0)
139 pdp11_extension
[PDP11_LEIS
] = yes
;
140 if (!pdp11_extension
[PDP11_LEIS
])
141 pdp11_extension
[PDP11_EIS
] = 0;
143 /* Move from processor type. */
144 else if (strcmp (arg
, "mfpt") == 0)
145 pdp11_extension
[PDP11_MFPT
] = yes
;
146 /* Multiprocessor insns: */
147 else if (strncmp (arg
, "mproc", 5) == 0
149 || strncmp (arg
, "multiproc", 9) == 0)
150 pdp11_extension
[PDP11_MPROC
] = yes
;
151 /* Move from/to proc status. */
152 else if (strcmp (arg
, "mxps") == 0)
153 pdp11_extension
[PDP11_MXPS
] = yes
;
154 /* Position-independent code. */
155 else if (strcmp (arg
, "pic") == 0)
156 asm_option
[ASM_OPT_PIC
] = yes
;
157 /* Set priority level. */
158 else if (strcmp (arg
, "spl") == 0)
159 pdp11_extension
[PDP11_SPL
] = yes
;
160 /* Microcode instructions: */
161 else if (strcmp (arg
, "ucode") == 0
163 || strcmp (arg
, "microcode") == 0)
164 pdp11_extension
[PDP11_UCODE
] = yes
;
175 static int first
= 1;
179 set_option ("all-extensions");
192 insn_hash
= hash_new ();
193 if (insn_hash
== NULL
)
194 as_fatal (_("Virtual memory exhausted"));
196 for (i
= 0; i
< pdp11_num_opcodes
; i
++)
197 hash_insert (insn_hash
, pdp11_opcodes
[i
].name
, (void *) (pdp11_opcodes
+ i
));
198 for (i
= 0; i
< pdp11_num_aliases
; i
++)
199 hash_insert (insn_hash
, pdp11_aliases
[i
].name
, (void *) (pdp11_aliases
+ i
));
203 md_number_to_chars (char con
[], valueT value
, int nbytes
)
205 /* On a PDP-11, 0x1234 is stored as "\x12\x34", and
206 0x12345678 is stored as "\x56\x78\x12\x34". It's
207 anyones guess what 0x123456 would be stored like. */
214 con
[0] = value
& 0xff;
217 con
[0] = value
& 0xff;
218 con
[1] = (value
>> 8) & 0xff;
221 con
[0] = (value
>> 16) & 0xff;
222 con
[1] = (value
>> 24) & 0xff;
223 con
[2] = value
& 0xff;
224 con
[3] = (value
>> 8) & 0xff;
231 /* Fix up some data or instructions after we find out the value of a symbol
232 that they reference. Knows about order of bytes in address. */
235 md_apply_fix (fixS
*fixP
,
237 segT seg ATTRIBUTE_UNUSED
)
246 buf
= fixP
->fx_where
+ fixP
->fx_frag
->fr_literal
;
247 size
= fixP
->fx_size
;
248 code
= md_chars_to_number ((unsigned char *) buf
, size
);
250 switch (fixP
->fx_r_type
)
253 case BFD_RELOC_16_PCREL
:
257 case BFD_RELOC_PDP11_DISP_8_PCREL
:
261 case BFD_RELOC_PDP11_DISP_6_PCREL
:
267 BAD_CASE (fixP
->fx_r_type
);
270 if (fixP
->fx_addsy
!= NULL
)
271 val
+= symbol_get_bfdsym (fixP
->fx_addsy
)->section
->vma
;
272 /* *value += fixP->fx_addsy->bsym->section->vma; */
275 code
|= (val
>> shift
) & mask
;
276 number_to_chars_littleendian (buf
, code
, size
);
278 if (fixP
->fx_addsy
== NULL
&& fixP
->fx_pcrel
== 0)
283 md_chars_to_number (con
, nbytes
)
284 unsigned char con
[]; /* Low order byte 1st. */
285 int nbytes
; /* Number of bytes in the input. */
287 /* On a PDP-11, 0x1234 is stored as "\x12\x34", and
288 0x12345678 is stored as "\x56\x78\x12\x34". It's
289 anyones guess what 0x123456 would be stored like. */
297 return (con
[1] << BITS_PER_CHAR
) | con
[0];
300 (((con
[1] << BITS_PER_CHAR
) | con
[0]) << (2 * BITS_PER_CHAR
))
301 |((con
[3] << BITS_PER_CHAR
) | con
[2]);
309 skip_whitespace (char *str
)
311 while (*str
== ' ' || *str
== '\t')
317 find_whitespace (char *str
)
319 while (*str
!= ' ' && *str
!= '\t' && *str
!= 0)
325 parse_reg (char *str
, struct pdp11_code
*operand
)
327 str
= skip_whitespace (str
);
328 if (TOLOWER (*str
) == 'r')
333 case '0': case '1': case '2': case '3':
334 case '4': case '5': case '6': case '7':
335 operand
->code
= *str
- '0';
339 operand
->error
= _("Bad register name");
343 else if (strncmp (str
, "sp", 2) == 0
344 || strncmp (str
, "SP", 2) == 0)
349 else if (strncmp (str
, "pc", 2) == 0
350 || strncmp (str
, "PC", 2) == 0)
357 operand
->error
= _("Bad register name");
365 parse_ac5 (char *str
, struct pdp11_code
*operand
)
367 str
= skip_whitespace (str
);
368 if (strncmp (str
, "fr", 2) == 0
369 || strncmp (str
, "FR", 2) == 0
370 || strncmp (str
, "ac", 2) == 0
371 || strncmp (str
, "AC", 2) == 0)
376 case '0': case '1': case '2': case '3':
378 operand
->code
= *str
- '0';
382 operand
->error
= _("Bad register name");
388 operand
->error
= _("Bad register name");
396 parse_ac (char *str
, struct pdp11_code
*operand
)
398 str
= parse_ac5 (str
, operand
);
399 if (!operand
->error
&& operand
->code
> 3)
401 operand
->error
= _("Bad register name");
409 parse_expression (char *str
, struct pdp11_code
*operand
)
411 char *save_input_line_pointer
;
414 save_input_line_pointer
= input_line_pointer
;
415 input_line_pointer
= str
;
416 seg
= expression (&operand
->reloc
.exp
);
419 input_line_pointer
= save_input_line_pointer
;
420 operand
->error
= _("Error in expression");
424 str
= input_line_pointer
;
425 input_line_pointer
= save_input_line_pointer
;
427 operand
->reloc
.pc_rel
= 0;
433 parse_op_no_deferred (char *str
, struct pdp11_code
*operand
)
435 LITTLENUM_TYPE literal_float
[2];
437 str
= skip_whitespace (str
);
441 case '(': /* (rn) and (rn)+ */
442 str
= parse_reg (str
+ 1, operand
);
445 str
= skip_whitespace (str
);
448 operand
->error
= _("Missing ')'");
454 operand
->code
|= 020;
459 operand
->code
|= 010;
466 str
= parse_expression (str
+ 1, operand
);
469 operand
->additional
= TRUE
;
470 operand
->word
= operand
->reloc
.exp
.X_add_number
;
471 switch (operand
->reloc
.exp
.X_op
)
478 operand
->reloc
.type
= BFD_RELOC_16
;
479 operand
->reloc
.pc_rel
= 0;
482 if (operand
->reloc
.exp
.X_add_number
> 0)
484 operand
->error
= _("Error in expression");
487 /* It's a floating literal... */
488 know (operand
->reloc
.exp
.X_add_number
< 0);
489 flonum_gen2vax ('f', &generic_floating_point_number
, literal_float
);
490 operand
->word
= literal_float
[0];
491 if (literal_float
[1] != 0)
492 as_warn (_("Low order bits truncated in immediate float operand"));
495 operand
->error
= _("Error in expression");
501 /* label, d(rn), -(rn) */
504 if (strncmp (str
, "-(", 2) == 0) /* -(rn) */
506 str
= parse_reg (str
+ 2, operand
);
509 str
= skip_whitespace (str
);
512 operand
->error
= _("Missing ')'");
515 operand
->code
|= 040;
520 str
= parse_expression (str
, operand
);
524 str
= skip_whitespace (str
);
529 operand
->additional
= 1;
531 operand
->reloc
.type
= BFD_RELOC_16_PCREL
;
532 operand
->reloc
.pc_rel
= 1;
538 str
= parse_reg (str
, operand
);
542 str
= skip_whitespace (str
);
546 operand
->error
= _("Missing ')'");
551 operand
->additional
= TRUE
;
552 operand
->code
|= 060;
553 switch (operand
->reloc
.exp
.X_op
)
556 operand
->reloc
.type
= BFD_RELOC_16
;
557 operand
->reloc
.pc_rel
= 0;
560 if ((operand
->code
& 7) == 7)
562 operand
->reloc
.pc_rel
= 1;
563 operand
->word
= operand
->reloc
.exp
.X_add_number
;
566 operand
->word
= operand
->reloc
.exp
.X_add_number
;
570 BAD_CASE (operand
->reloc
.exp
.X_op
);
580 parse_op_noreg (char *str
, struct pdp11_code
*operand
)
582 str
= skip_whitespace (str
);
583 operand
->error
= NULL
;
585 if (*str
== '@' || *str
== '*')
587 str
= parse_op_no_deferred (str
+ 1, operand
);
590 operand
->code
|= 010;
593 str
= parse_op_no_deferred (str
, operand
);
599 parse_op (char *str
, struct pdp11_code
*operand
)
601 str
= skip_whitespace (str
);
603 str
= parse_reg (str
, operand
);
607 operand
->error
= NULL
;
608 parse_ac5 (str
, operand
);
611 operand
->error
= _("Float AC not legal as integer operand");
615 return parse_op_noreg (str
, operand
);
619 parse_fop (char *str
, struct pdp11_code
*operand
)
621 str
= skip_whitespace (str
);
623 str
= parse_ac5 (str
, operand
);
627 operand
->error
= NULL
;
628 parse_reg (str
, operand
);
631 operand
->error
= _("General register not legal as float operand");
635 return parse_op_noreg (str
, operand
);
639 parse_separator (char *str
, int *error
)
641 str
= skip_whitespace (str
);
642 *error
= (*str
!= ',');
649 md_assemble (char *instruction_string
)
651 const struct pdp11_opcode
*op
;
652 struct pdp11_code insn
, op1
, op2
;
660 str
= skip_whitespace (instruction_string
);
661 p
= find_whitespace (str
);
664 as_bad (_("No instruction found"));
670 op
= (struct pdp11_opcode
*)hash_find (insn_hash
, str
);
674 as_bad (_("Unknown instruction '%s'"), str
);
678 if (!pdp11_extension
[op
->extension
])
680 as_warn (_("Unsupported instruction set extension: %s"), op
->name
);
685 insn
.code
= op
->opcode
;
686 insn
.reloc
.type
= BFD_RELOC_NONE
;
688 op1
.additional
= FALSE
;
689 op1
.reloc
.type
= BFD_RELOC_NONE
;
691 op2
.additional
= FALSE
;
692 op2
.reloc
.type
= BFD_RELOC_NONE
;
699 case PDP11_OPCODE_NO_OPS
:
700 str
= skip_whitespace (str
);
705 case PDP11_OPCODE_IMM3
:
706 case PDP11_OPCODE_IMM6
:
707 case PDP11_OPCODE_IMM8
:
708 str
= skip_whitespace (str
);
709 if (*str
== '#' || *str
== '$')
711 str
= parse_expression (str
, &op1
);
714 if (op1
.reloc
.exp
.X_op
!= O_constant
|| op1
.reloc
.type
!= BFD_RELOC_NONE
)
716 op1
.error
= _("operand is not an absolute constant");
721 case PDP11_OPCODE_IMM3
:
722 if (op1
.reloc
.exp
.X_add_number
& ~7)
724 op1
.error
= _("3-bit immediate out of range");
728 case PDP11_OPCODE_IMM6
:
729 if (op1
.reloc
.exp
.X_add_number
& ~0x3f)
731 op1
.error
= _("6-bit immediate out of range");
735 case PDP11_OPCODE_IMM8
:
736 if (op1
.reloc
.exp
.X_add_number
& ~0xff)
738 op1
.error
= _("8-bit immediate out of range");
743 insn
.code
|= op1
.reloc
.exp
.X_add_number
;
746 case PDP11_OPCODE_DISPL
:
749 new_pointer
= parse_expression (str
, &op1
);
751 op1
.reloc
.pc_rel
= 1;
752 op1
.reloc
.type
= BFD_RELOC_PDP11_DISP_8_PCREL
;
753 if (op1
.reloc
.exp
.X_op
!= O_symbol
)
755 op1
.error
= _("Symbol expected");
758 if (op1
.code
& ~0xff)
760 err
= _("8-bit displacement out of range");
764 insn
.code
|= op1
.code
;
765 insn
.reloc
= op1
.reloc
;
769 case PDP11_OPCODE_REG
:
770 str
= parse_reg (str
, &op1
);
773 insn
.code
|= op1
.code
;
776 case PDP11_OPCODE_OP
:
777 str
= parse_op (str
, &op1
);
780 insn
.code
|= op1
.code
;
785 case PDP11_OPCODE_FOP
:
786 str
= parse_fop (str
, &op1
);
789 insn
.code
|= op1
.code
;
794 case PDP11_OPCODE_REG_OP
:
795 str
= parse_reg (str
, &op2
);
798 insn
.code
|= op2
.code
<< 6;
799 str
= parse_separator (str
, &error
);
802 op2
.error
= _("Missing ','");
805 str
= parse_op (str
, &op1
);
808 insn
.code
|= op1
.code
;
813 case PDP11_OPCODE_REG_OP_REV
:
814 str
= parse_op (str
, &op1
);
817 insn
.code
|= op1
.code
;
820 str
= parse_separator (str
, &error
);
823 op2
.error
= _("Missing ','");
826 str
= parse_reg (str
, &op2
);
829 insn
.code
|= op2
.code
<< 6;
832 case PDP11_OPCODE_AC_FOP
:
833 str
= parse_ac (str
, &op2
);
836 insn
.code
|= op2
.code
<< 6;
837 str
= parse_separator (str
, &error
);
840 op1
.error
= _("Missing ','");
843 str
= parse_fop (str
, &op1
);
846 insn
.code
|= op1
.code
;
851 case PDP11_OPCODE_FOP_AC
:
852 str
= parse_fop (str
, &op1
);
855 insn
.code
|= op1
.code
;
858 str
= parse_separator (str
, &error
);
861 op1
.error
= _("Missing ','");
864 str
= parse_ac (str
, &op2
);
867 insn
.code
|= op2
.code
<< 6;
870 case PDP11_OPCODE_AC_OP
:
871 str
= parse_ac (str
, &op2
);
874 insn
.code
|= op2
.code
<< 6;
875 str
= parse_separator (str
, &error
);
878 op1
.error
= _("Missing ','");
881 str
= parse_op (str
, &op1
);
884 insn
.code
|= op1
.code
;
889 case PDP11_OPCODE_OP_AC
:
890 str
= parse_op (str
, &op1
);
893 insn
.code
|= op1
.code
;
896 str
= parse_separator (str
, &error
);
899 op1
.error
= _("Missing ','");
902 str
= parse_ac (str
, &op2
);
905 insn
.code
|= op2
.code
<< 6;
908 case PDP11_OPCODE_OP_OP
:
909 str
= parse_op (str
, &op1
);
912 insn
.code
|= op1
.code
<< 6;
915 str
= parse_separator (str
, &error
);
918 op2
.error
= _("Missing ','");
921 str
= parse_op (str
, &op2
);
924 insn
.code
|= op2
.code
;
929 case PDP11_OPCODE_REG_DISPL
:
932 str
= parse_reg (str
, &op2
);
935 insn
.code
|= op2
.code
<< 6;
936 str
= parse_separator (str
, &error
);
939 op1
.error
= _("Missing ','");
942 new_pointer
= parse_expression (str
, &op1
);
944 op1
.reloc
.pc_rel
= 1;
945 op1
.reloc
.type
= BFD_RELOC_PDP11_DISP_6_PCREL
;
946 if (op1
.reloc
.exp
.X_op
!= O_symbol
)
948 op1
.error
= _("Symbol expected");
951 if (op1
.code
& ~0x3f)
953 err
= _("6-bit displacement out of range");
957 insn
.code
|= op1
.code
;
958 insn
.reloc
= op1
.reloc
;
972 str
= skip_whitespace (str
);
974 err
= _("Too many operands");
986 to
= frag_more (size
);
988 md_number_to_chars (to
, insn
.code
, 2);
989 if (insn
.reloc
.type
!= BFD_RELOC_NONE
)
990 fix_new_exp (frag_now
, to
- frag_now
->fr_literal
, 2,
991 &insn
.reloc
.exp
, insn
.reloc
.pc_rel
, insn
.reloc
.type
);
996 md_number_to_chars (to
, op1
.word
, 2);
997 if (op1
.reloc
.type
!= BFD_RELOC_NONE
)
998 fix_new_exp (frag_now
, to
- frag_now
->fr_literal
, 2,
999 &op1
.reloc
.exp
, op1
.reloc
.pc_rel
, op1
.reloc
.type
);
1005 md_number_to_chars (to
, op2
.word
, 2);
1006 if (op2
.reloc
.type
!= BFD_RELOC_NONE
)
1007 fix_new_exp (frag_now
, to
- frag_now
->fr_literal
, 2,
1008 &op2
.reloc
.exp
, op2
.reloc
.pc_rel
, op2
.reloc
.type
);
1014 md_estimate_size_before_relax (fragS
*fragP ATTRIBUTE_UNUSED
,
1015 segT segment ATTRIBUTE_UNUSED
)
1021 md_convert_frag (bfd
*headers ATTRIBUTE_UNUSED
,
1022 segT seg ATTRIBUTE_UNUSED
,
1023 fragS
*fragP ATTRIBUTE_UNUSED
)
1027 int md_short_jump_size
= 2;
1028 int md_long_jump_size
= 4;
1031 md_create_short_jump (char *ptr ATTRIBUTE_UNUSED
,
1032 addressT from_addr ATTRIBUTE_UNUSED
,
1033 addressT to_addr ATTRIBUTE_UNUSED
,
1034 fragS
*frag ATTRIBUTE_UNUSED
,
1035 symbolS
*to_symbol ATTRIBUTE_UNUSED
)
1040 md_create_long_jump (char *ptr ATTRIBUTE_UNUSED
,
1041 addressT from_addr ATTRIBUTE_UNUSED
,
1042 addressT to_addr ATTRIBUTE_UNUSED
,
1043 fragS
*frag ATTRIBUTE_UNUSED
,
1044 symbolS
*to_symbol ATTRIBUTE_UNUSED
)
1049 set_cpu_model (char *arg
)
1059 if (strchr ("abdx", model
[-1]) == NULL
)
1062 if (model
[-1] == 'd')
1064 if (arg
[0] == 'f' || arg
[0] == 'j')
1067 else if (model
[-1] == 'x')
1076 if (strncmp (arg
, "11", 2) != 0)
1086 /* Allow up to two revision letters. */
1094 set_option ("no-extensions");
1096 /* KA11 (11/15/20). */
1097 if (strncmp (buf
, "a", 1) == 0)
1098 return 1; /* No extensions. */
1100 /* KB11 (11/45/50/55/70). */
1101 else if (strncmp (buf
, "b", 1) == 0)
1102 return set_option ("eis") && set_option ("spl");
1104 /* KD11-A (11/35/40). */
1105 else if (strncmp (buf
, "da", 2) == 0)
1106 return set_option ("limited-eis");
1108 /* KD11-B (11/05/10). */
1109 else if (strncmp (buf
, "db", 2) == 0
1110 /* KD11-D (11/04). */
1111 || strncmp (buf
, "dd", 2) == 0)
1112 return 1; /* no extensions */
1114 /* KD11-E (11/34). */
1115 else if (strncmp (buf
, "de", 2) == 0)
1116 return set_option ("eis") && set_option ("mxps");
1118 /* KD11-F (11/03). */
1119 else if (strncmp (buf
, "df", 2) == 0
1120 /* KD11-H (11/03). */
1121 || strncmp (buf
, "dh", 2) == 0
1122 /* KD11-Q (11/03). */
1123 || strncmp (buf
, "dq", 2) == 0)
1124 return set_option ("limited-eis") && set_option ("mxps");
1126 /* KD11-K (11/60). */
1127 else if (strncmp (buf
, "dk", 2) == 0)
1128 return set_option ("eis")
1129 && set_option ("mxps")
1130 && set_option ("ucode");
1132 /* KD11-Z (11/44). */
1133 else if (strncmp (buf
, "dz", 2) == 0)
1134 return set_option ("csm")
1135 && set_option ("eis")
1136 && set_option ("mfpt")
1137 && set_option ("mxps")
1138 && set_option ("spl");
1140 /* F11 (11/23/24). */
1141 else if (strncmp (buf
, "f", 1) == 0)
1142 return set_option ("eis")
1143 && set_option ("mfpt")
1144 && set_option ("mxps");
1146 /* J11 (11/53/73/83/84/93/94). */
1147 else if (strncmp (buf
, "j", 1) == 0)
1148 return set_option ("csm")
1149 && set_option ("eis")
1150 && set_option ("mfpt")
1151 && set_option ("multiproc")
1152 && set_option ("mxps")
1153 && set_option ("spl");
1156 else if (strncmp (buf
, "t", 1) == 0)
1157 return set_option ("limited-eis")
1158 && set_option ("mxps");
1165 set_machine_model (char *arg
)
1167 if (strncmp (arg
, "pdp-11/", 7) != 0
1168 && strncmp (arg
, "pdp11/", 6) != 0
1169 && strncmp (arg
, "11/", 3) != 0)
1172 if (strncmp (arg
, "pdp", 3) == 0)
1176 if (strncmp (arg
, "11/", 3) == 0)
1179 if (strcmp (arg
, "03") == 0)
1180 return set_cpu_model ("kd11f");
1182 else if (strcmp (arg
, "04") == 0)
1183 return set_cpu_model ("kd11d");
1185 else if (strcmp (arg
, "05") == 0
1186 || strcmp (arg
, "10") == 0)
1187 return set_cpu_model ("kd11b");
1189 else if (strcmp (arg
, "15") == 0
1190 || strcmp (arg
, "20") == 0)
1191 return set_cpu_model ("ka11");
1193 else if (strcmp (arg
, "21") == 0)
1194 return set_cpu_model ("t11");
1196 else if (strcmp (arg
, "23") == 0
1197 || strcmp (arg
, "24") == 0)
1198 return set_cpu_model ("f11");
1200 else if (strcmp (arg
, "34") == 0
1201 || strcmp (arg
, "34a") == 0)
1202 return set_cpu_model ("kd11e");
1204 else if (strcmp (arg
, "35") == 0
1205 || strcmp (arg
, "40") == 0)
1206 return set_cpu_model ("kd11da");
1208 else if (strcmp (arg
, "44") == 0)
1209 return set_cpu_model ("kd11dz");
1211 else if (strcmp (arg
, "45") == 0
1212 || strcmp (arg
, "50") == 0
1213 || strcmp (arg
, "55") == 0
1214 || strcmp (arg
, "70") == 0)
1215 return set_cpu_model ("kb11");
1217 else if (strcmp (arg
, "60") == 0)
1218 return set_cpu_model ("kd11k");
1220 else if (strcmp (arg
, "53") == 0
1221 || strcmp (arg
, "73") == 0
1222 || strcmp (arg
, "83") == 0
1223 || strcmp (arg
, "84") == 0
1224 || strcmp (arg
, "93") == 0
1225 || strcmp (arg
, "94") == 0)
1226 return set_cpu_model ("j11")
1227 && set_option ("fpp");
1233 const char *md_shortopts
= "m:";
1235 struct option md_longopts
[] =
1237 #define OPTION_CPU 257
1238 { "cpu", required_argument
, NULL
, OPTION_CPU
},
1239 #define OPTION_MACHINE 258
1240 { "machine", required_argument
, NULL
, OPTION_MACHINE
},
1241 #define OPTION_PIC 259
1242 { "pic", no_argument
, NULL
, OPTION_PIC
},
1243 { NULL
, no_argument
, NULL
, 0 }
1246 size_t md_longopts_size
= sizeof (md_longopts
);
1248 /* Invocation line includes a switch not recognized by the base assembler.
1249 See if it's a processor-specific option. */
1252 md_parse_option (int c
, char *arg
)
1259 if (set_option (arg
))
1261 if (set_cpu_model (arg
))
1263 if (set_machine_model (arg
))
1268 if (set_cpu_model (arg
))
1272 case OPTION_MACHINE
:
1273 if (set_machine_model (arg
))
1278 if (set_option ("pic"))
1290 md_show_usage (FILE *stream
)
1294 PDP-11 instruction set extentions:\n\
1296 -m(no-)cis allow (disallow) commersial instruction set\n\
1297 -m(no-)csm allow (disallow) CSM instruction\n\
1298 -m(no-)eis allow (disallow) full extended instruction set\n\
1299 -m(no-)fis allow (disallow) KEV11 floating-point instructions\n\
1300 -m(no-)fpp allow (disallow) FP-11 floating-point instructions\n\
1301 -m(no-)fpu allow (disallow) FP-11 floating-point instructions\n\
1302 -m(no-)limited-eis allow (disallow) limited extended instruction set\n\
1303 -m(no-)mfpt allow (disallow) processor type instruction\n\
1304 -m(no-)multiproc allow (disallow) multiprocessor instructions\n\
1305 -m(no-)mxps allow (disallow) processor status instructions\n\
1306 -m(no-)spl allow (disallow) SPL instruction\n\
1307 -m(no-)ucode allow (disallow) microcode instructions\n\
1308 -mall-extensions allow all instruction set extensions\n\
1309 (this is the default)\n\
1310 -mno-extentions disallow all instruction set extensions\n\
1311 -pic generate position-indepenent code\n\
1313 PDP-11 CPU model options:\n\
1315 -mka11* KA11 CPU. base line instruction set only\n\
1316 -mkb11* KB11 CPU. enable full EIS and SPL\n\
1317 -mkd11a* KD11-A CPU. enable limited EIS\n\
1318 -mkd11b* KD11-B CPU. base line instruction set only\n\
1319 -mkd11d* KD11-D CPU. base line instruction set only\n\
1320 -mkd11e* KD11-E CPU. enable full EIS, MTPS, and MFPS\n\
1321 -mkd11f* KD11-F CPU. enable limited EIS, MTPS, and MFPS\n\
1322 -mkd11h* KD11-H CPU. enable limited EIS, MTPS, and MFPS\n\
1323 -mkd11q* KD11-Q CPU. enable limited EIS, MTPS, and MFPS\n\
1324 -mkd11k* KD11-K CPU. enable full EIS, MTPS, MFPS, LDUB, MED,\n\
1326 -mkd11z* KD11-Z CPU. enable full EIS, MTPS, MFPS, MFPT, SPL,\n\
1328 -mf11* F11 CPU. enable full EIS, MFPS, MTPS, and MFPT\n\
1329 -mj11* J11 CPU. enable full EIS, MTPS, MFPS, MFPT, SPL,\n\
1330 CSM, TSTSET, and WRTLCK\n\
1331 -mt11* T11 CPU. enable limited EIS, MTPS, and MFPS\n\
1333 PDP-11 machine model options:\n\
1335 -m11/03 same as -mkd11f\n\
1336 -m11/04 same as -mkd11d\n\
1337 -m11/05 same as -mkd11b\n\
1338 -m11/10 same as -mkd11b\n\
1339 -m11/15 same as -mka11\n\
1340 -m11/20 same as -mka11\n\
1341 -m11/21 same as -mt11\n\
1342 -m11/23 same as -mf11\n\
1343 -m11/24 same as -mf11\n\
1344 -m11/34 same as -mkd11e\n\
1345 -m11/34a same as -mkd11e -mfpp\n\
1346 -m11/35 same as -mkd11a\n\
1347 -m11/40 same as -mkd11a\n\
1348 -m11/44 same as -mkd11z\n\
1349 -m11/45 same as -mkb11\n\
1350 -m11/50 same as -mkb11\n\
1351 -m11/53 same as -mj11\n\
1352 -m11/55 same as -mkb11\n\
1353 -m11/60 same as -mkd11k\n\
1354 -m11/70 same as -mkb11\n\
1355 -m11/73 same as -mj11\n\
1356 -m11/83 same as -mj11\n\
1357 -m11/84 same as -mj11\n\
1358 -m11/93 same as -mj11\n\
1359 -m11/94 same as -mj11\n\
1364 md_undefined_symbol (char *name ATTRIBUTE_UNUSED
)
1370 md_section_align (segT segment ATTRIBUTE_UNUSED
,
1373 return (size
+ 1) & ~1;
1377 md_pcrel_from (fixS
*fixP
)
1379 return fixP
->fx_frag
->fr_address
+ fixP
->fx_where
+ fixP
->fx_size
;
1382 /* Translate internal representation of relocation info to BFD target
1386 tc_gen_reloc (asection
*section ATTRIBUTE_UNUSED
,
1390 bfd_reloc_code_real_type code
;
1392 reloc
= xmalloc (sizeof (* reloc
));
1394 reloc
->sym_ptr_ptr
= xmalloc (sizeof (asymbol
*));
1395 *reloc
->sym_ptr_ptr
= symbol_get_bfdsym (fixp
->fx_addsy
);
1396 reloc
->address
= fixp
->fx_frag
->fr_address
+ fixp
->fx_where
;
1398 /* This is taken account for in md_apply_fix(). */
1399 reloc
->addend
= -symbol_get_bfdsym (fixp
->fx_addsy
)->section
->vma
;
1401 switch (fixp
->fx_r_type
)
1405 code
= BFD_RELOC_16_PCREL
;
1407 code
= BFD_RELOC_16
;
1410 case BFD_RELOC_16_PCREL
:
1411 code
= BFD_RELOC_16_PCREL
;
1415 BAD_CASE (fixp
->fx_r_type
);
1419 reloc
->howto
= bfd_reloc_type_lookup (stdoutput
, code
);
1421 if (reloc
->howto
== NULL
)
1423 as_bad_where (fixp
->fx_file
, fixp
->fx_line
,
1424 _("Can not represent %s relocation in this object file format"),
1425 bfd_get_reloc_code_name (code
));
1433 pseudo_bss (int c ATTRIBUTE_UNUSED
)
1437 temp
= get_absolute_expression ();
1438 subseg_set (bss_section
, temp
);
1439 demand_empty_rest_of_line ();
1443 pseudo_even (int c ATTRIBUTE_UNUSED
)
1445 int alignment
= 1; /* 2^1 */
1446 frag_align (alignment
, 0, 1);
1447 record_alignment (now_seg
, alignment
);
1451 md_atof (int type
, char * litP
, int * sizeP
)
1453 return vax_md_atof (type
, litP
, sizeP
);