1 The m68k2 back end is an EM code generator for the
2 Motorola MC68000. It defines an integer to be 16 bits
3 and a pointer to be 32 bits.
4 The m68k2 back end generates code for the ACK 68000 assembler.
5 (The mnemonics recognized by this assembler can be found in
8 Some parts of the back end are system dependent, i.e. they depend
9 on the kind of target 68000 system.
10 - The way to do a Unix system call may vary from system to system.
11 For every system call you need to have an assembly routine that
12 passes the arguments and the system call number to Unix.
13 These routines should be put in the library file "lib/tail_mon".
14 The distribution contains a tail_mon file tailored for
15 UniSoft Unix (see directory "libsys").
16 Beware that several Unix systems (e.g. UniSoft Unix) use 4-byte
17 integers, whereas the m68k2 back end produces code for 2-byte
18 integers. In this case all system calls having an "int" parameter
19 should convert their parameters to "long"s.
20 - Most systems require some sort of "test for enough stack space"
21 at the beginning of every procedure, to get around the "back up"
22 problem. E.g. UniSoft Unix requires a "tst.b N(sp)" instruction
23 This instruction is generated by the routines "prolog()" and
24 "save" in "cg/mach.c".
25 - The output of the ACK 68000 linker is an a.out file that
26 has a different format as an a.out file on your system. (As most
27 68000 systems have different a.out formats, there is no such thing
28 as "the" 68000 a.out format). So a program is needed to convert the
29 ACK a.out format to your a.out format (as defined in
30 "/usr/include/a.out.h"). The program "cv/cv.c" does
31 the job for UniSoft Unix. It probably need only be slightly
32 modified for your system.
33 If your target 68000 does not run Unix, but is e.g. a stand alone
34 68000, you will need a program to download the ACK a.out file.
35 The program "dl/dl.c" produces Intel Hex format on standard output
37 - The EM runtime start-off ("libsys/head_em.s") may have to be modified.
38 It should call the procedure __m_a_i_n with parameters (argc,argv,envp).
39 Usually, Unix will put these on top of the stack before starting
40 the program. Note, however, that for 4-byte systems Unix will provide
41 a 4-byte argc, while __m_a_i_n expects a 2-byte argc; so the value
42 must be shortened to 2 bytes.
45 The m68k2 code generator translates most EM instructions in line.
46 For some complex EM instructions it uses assembly routines (stored in the
47 library "libem/libem_s.a").
49 The generated code does not check for array bound errors, overflow in
50 arithmetic operations or division by zero (the latter will cause a hardware
53 The code generator has the following register conventions:
55 a6: local base pointer
56 a0,a1,d0,d1,d2: scratch registers
57 (d0 is also used for 2/4 bytes function results;
58 d0 and d1 are used for 8 bytes function results)
59 a2-a5,d3-d7: register variables.