mb@ttidca.TTI.COM (Michael Bloom) (07/29/87)
I recieved emacs 18.47 a couple of days ago, and it has been by far the easiest version to get running on my ICM-3216. Part of this was because I already had an alloca written, and part was bacuase of changes in emacs itself since 18.36. Note that these changes apply only to 4.2BSD. If you are running System V, other changes will be needed. The shar file below contains four files. They are: README.ICM: Instructions for using the other files. m-icm.h: A new icm machine description file, which #includes m-ns16000.h. icm-alloca.s: A version of alloca for the ICM-3216. src.diffs: contains diffs for crt0.c (one line of change) and alloca.s (adds a #include of icm-alloc.s) -------------------- CUT HERE -------------------- # This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # README.ICM icm-alloca.s m-icm.h src.diffs echo x - README.ICM cat > "README.ICM" << '//E*O*F README.ICM//' Here are diffs for emacs 18.47 to run on an ICM-3216 running 4.2 BSD. These are much simpler than the previous ones which were against an earlier emacs version. You should have four files here. This one (README.ICM), m-icm.h, icm-alloca.s, and src.diffs. To build emacs on your 4.2 icm: 1) edit config.h to change the #include of "m-???.h" to include "m-icm.h". 2) apply the diffs in src.diffs. 3) run make. NOTES: 1) The diff of crt0.c has one line of change, which I think rms would have no problem in adding in future releases. It prevents an incorrect version of _start() from accompanying the correct one in the C preprocessor output. 2) The diff of alloca.s just provides inclusion of icm-alloca.s. This is kind of ugly, but simpler than having to add the icm version of alloca to alloca.s with each new emacs release. An alternative would be to assemble icm-alloca once, and add the resulting alloca.o to /lib/libc.a on your system, after which you could add HAVE_ALLOCA to your own copy of m-icm.h, and not have to bother changing alloca.s in the future. //E*O*F README.ICM// echo x - icm-alloca.s cat > "icm-alloca.s" << '//E*O*F icm-alloca.s//' /* * National Semi ICM-3216 running U of Toronto 4.2BSD * 32016 using MOD register linkage: * * Can't just do a return REGISTER(r1) as with jsr style. The cxp * that got us here pushed the old MOD onto the stack, gave us a * new one, then loaded SB from location MOD+0. Proper return * requires restoring the old MOD and SB registers. We could do * that by hand using the (expensive) lprd and sprd instructions, * but it would be messier and and up using more cycles. * We also avoid using registers other than r0, because some code * calling alloca uses r1 or r2. * * - Michael Bloom, Citicorp/TTI (05-02-87) * * Stack layout: * sp prior to cxp -> pc for cxp to restore * mod for cxp to restore * (after cxp) sp -> junk for adjsp to throw away * registers (copy) * r0 -> new data * | (orig ret pc) * | (orig ret mod) * | (orig arg) * old sp -> regs (orig) * local data * fp -> old fp */ #define ARG 4 #define PC 4 #ifdef USECXP #define MOD 4 #else #define MOD 0 #endif #define ARGLOC MOD + 4 #define REG0 ARG + MOD + PC .text #ifdef USECXP .routine _alloca #else #define rxp ret #endif .globl _alloca _alloca: sprd sp,r0 /* mov sp to r0 */ addd $40,ARGLOC (sp) /* add 32+4+4 for regs, align, junk */ bicb $3,ARGLOC (sp) /* 4 byte align */ adjspd ARGLOC (r0) /* adjust stack by 32 + slop + ARG */ #ifdef USECXP movd 4(r0),tos /* push saved MOD */ #endif USECXP movd 0(r0),tos /* push return PC */ movmd REG0+16(r0),REG0+16(sp),$4 /* save regs */ movmd REG0(r0),REG0(sp),$4 /* just past pc,mod,junk */ sprd sp,r0 /* move sp into r0 */ addd $44,r0 /* adjust return value */ rxp $0 //E*O*F icm-alloca.s// echo x - m-icm.h cat > "m-icm.h" << '//E*O*F m-icm.h//' #include "m-ns16000.h" #define icm3216 /* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend the 24-bit bit field into an int. In other words, if bit fields are always unsigned. If you use NO_UNION_TYPE, this flag does not matter. */ #define EXPLICIT_SIGN_EXTEND /* Define C_ALLOCA if this machine does not support a true alloca and the one written in C should be used instead. Define HAVE_ALLOCA to say that the system provides a properly working alloca function and it should be used. Define neither one if an assembler-language alloca in the file alloca.s should be used. */ /*#define C_ALLOCA*/ /*#define HAVE_ALLOCA*/ /* In case you use C_ALLOCA */ #define STACK_DIRECTION -1 /* Prevent Brain Damage */ #define static #define C_DEBUG_SWITCH #define LIBS_DEBUG #define C_OPTIMIZE_SWITCH /* crt0.c should define a symbol `start' and do .globl with a dot. not sure it's needed, but it doesn't seem to hurt. Borrowed from m-sequent.h */ #define DOT_GLOBAL_START #define TEXT_START 0 /* Subtract a page from the text/data boundary. This seems to no longer be needed as of 18.47. It was with 18.36, however. */ #define ADDR_SUBTRACT 0x400 /* For 4.2 (at least for now), must use the cxp calling sequence, which is the default. Tried jsr, there seem to be more severe problems to be worked out. Resolving them should improve performance */ #ifndef USG #define USECXP #endif #ifndef USECXP #define C_SWITCH_MACHINE -j #define LIB_STANDARD -lc_j #else #define C_SWITCH_MACHINE -O #define LIB_STANDARD -lc #endif #define CRT0_DUMMIES bogus_fp, //E*O*F m-icm.h// echo x - src.diffs cat > "src.diffs" << '//E*O*F src.diffs//' diff -c /a4/mab/src/emacs-18.47/src/alloca.s src/alloca.s *** /a4/mab/src/emacs-18.47/src/alloca.s Fri Oct 17 01:49:15 1986 --- src/alloca.s Tue Jul 28 01:03:04 1987 *************** *** 180,186 **** #endif /* not hp9000 */ #ifdef ns16000 ! .text .align 2 /* Some systems want the _, some do not. Win with both kinds. */ --- 180,188 ---- #endif /* not hp9000 */ #ifdef ns16000 ! #ifdef icm3216 ! #include "icm-alloca.s" ! #else .text .align 2 /* Some systems want the _, some do not. Win with both kinds. */ *************** *** 226,231 **** --- 228,234 ---- movmd 0(r2),4(sp),IM/**/4 /* copy regs */ movmd 0x10(r2),0x14(sp),IM/**/4 jump REGISTER(r1) /* funky return */ + #endif /* icm3216*/ #endif /* ns16000 */ #ifdef pyramid diff -c /a4/mab/src/emacs-18.47/src/crt0.c src/crt0.c *** /a4/mab/src/emacs-18.47/src/crt0.c Sun Jun 14 13:11:23 1987 --- src/crt0.c Sun Jul 26 22:08:54 1987 *************** *** 173,179 **** #endif /* orion or pyramid or celerity or alliant */ ! #if defined (ns16000) && !defined (sequent) && !defined (UMAX) _start () { --- 173,179 ---- #endif /* orion or pyramid or celerity or alliant */ ! #if defined (ns16000) && !defined (sequent) && !defined (UMAX) &&!defined(CRT0_DUMMIES) _start () { //E*O*F src.diffs// exit 0