diff --git a/doc/em/env.nr b/doc/em/env.nr index 7252b1a55..6d7b9a105 100644 --- a/doc/em/env.nr +++ b/doc/em/env.nr @@ -8,7 +8,7 @@ The remaining way to interact, interrupts, will be treated together with traps in chapter 9. .S2 "Program starting and stopping" EM user programs start with a call to a procedure called -m_a_i_n. +_m_a_i_n. The assembler and backends look for the definition of a procedure with this name in their input. The call passes three parameters to the procedure. @@ -45,7 +45,7 @@ The is terminated by a zero pointer. .P An EM user program stops if the program returns from the first -invocation of m_a_i_n. +invocation of _m_a_i_n. The contents of the function return area are used to procure a wordsized program return code. EM programs also stop when traps and interrupts occur that are diff --git a/doc/i80.doc b/doc/i80.doc index 8de34e9c1..8e876431b 100644 --- a/doc/i80.doc +++ b/doc/i80.doc @@ -545,7 +545,7 @@ stackpointer are set to 0x1000 and 0x8000 respectively. .br Other systems require other values. .IP 2) -In 'head_em': before calling "_m_a_i_n", the environment +In 'head_em': before calling "__m_a_i_n", the environment pointer, argument vector and argument count will have to be pushed onto the stack. Since this back-end is tested on a system without any knowledge diff --git a/doc/z80.doc b/doc/z80.doc index 1976ca260..77f1a75b9 100644 --- a/doc/z80.doc +++ b/doc/z80.doc @@ -36,7 +36,7 @@ stackpointer are set to 0x1000 and 0x7ffe respectivally. The latter because it could run on a 32K machine as well. Other systems require other values. .IP 2) -In \fIhead_em\fP: before calling "_m_a_i_n", the environment +In \fIhead_em\fP: before calling "__m_a_i_n", the environment pointer, argument vector and argument count will have to be pushed onto the stack. Since this back-end is tested on a system without any knowledge diff --git a/emtest/select.c b/emtest/select.c index 9b2624aba..0865d90a7 100644 --- a/emtest/select.c +++ b/emtest/select.c @@ -182,8 +182,8 @@ combine() { if (nhol) printf(" hol %d,0,0\n", nhol); copy(name1); - printf(" exp $m_a_i_n\n"); - printf(" pro $m_a_i_n,%d\n", nlocals); + printf(" exp $_m_a_i_n\n"); + printf(" pro $_m_a_i_n,%d\n", nlocals); printf(" loc 123\n"); printf(" loc -98\n"); copy(name2); diff --git a/lang/cem/libcc.ansi/head_ac.e b/lang/cem/libcc.ansi/head_ac.e index 3871d6a88..079436b93 100644 --- a/lang/cem/libcc.ansi/head_ac.e +++ b/lang/cem/libcc.ansi/head_ac.e @@ -17,8 +17,6 @@ * */ -/* Author: E.G. Keizer */ - mes 2,_EM_WSIZE,_EM_PSIZE exa environ @@ -27,8 +25,8 @@ _penvp bss _EM_PSIZE,0,0 - exp $m_a_i_n - pro $m_a_i_n,0 + exp $_m_a_i_n + pro $_m_a_i_n,0 loc 1336 ; EIOVFL | EIUND | ECONV | EFOVFL | EFUNFL sim ; ignored lal _EM_WSIZE+_EM_PSIZE diff --git a/lang/cem/libcc/gen/head_cc.e b/lang/cem/libcc/gen/head_cc.e index 88bd2a68f..60e3a039d 100644 --- a/lang/cem/libcc/gen/head_cc.e +++ b/lang/cem/libcc/gen/head_cc.e @@ -28,8 +28,8 @@ environ _penvp bss EM_PSIZE,0,0 - exp $m_a_i_n - pro $m_a_i_n,0 + exp $_m_a_i_n + pro $_m_a_i_n,0 #if EM_WSIZE==1 ldc 1336 ; EIOVFL | EIUND | ECONV | EFOVFL | EFUNFL #else diff --git a/lang/m2/libm2/head_m2.e b/lang/m2/libm2/head_m2.e index e6ef00b59..6a4e89207 100644 --- a/lang/m2/libm2/head_m2.e +++ b/lang/m2/libm2/head_m2.e @@ -24,8 +24,8 @@ bkillbss bss EM_PSIZE,0,0 - exp $m_a_i_n - pro $m_a_i_n, 0 + exp $_m_a_i_n + pro $_m_a_i_n, 0 lor 0 lae MainLB diff --git a/lang/pc/comp/code.c b/lang/pc/comp/code.c index 2f2c84ae0..5f878475e 100644 --- a/lang/pc/comp/code.c +++ b/lang/pc/comp/code.c @@ -118,8 +118,8 @@ CodeBeginBlock(df) if ( df->df_kind == D_MODULE) /* nothing */ ; else if (df->df_kind == D_PROGRAM ) { - C_exp("m_a_i_n"); - C_pro_narg("m_a_i_n"); + C_exp("_m_a_i_n"); + C_pro_narg("_m_a_i_n"); C_ms_par((arith) 0); offset = CodeGtoDescr(df->prc_vis->sc_scope); CodeFil(); diff --git a/lang/pc/comp/stab.c b/lang/pc/comp/stab.c index 8a9f5be02..acc9aa938 100644 --- a/lang/pc/comp/stab.c +++ b/lang/pc/comp/stab.c @@ -241,7 +241,7 @@ stb_string(df, kind) addc_db_str(':'); if (kind == D_MODULE) { adds_db_str(sprint(buf, "M%d;", df->prc_vis->sc_count)); - C_ms_stb_pnam(db_str.base, N_FUN, proclevel, "m_a_i_n"); + C_ms_stb_pnam(db_str.base, N_FUN, proclevel, "_m_a_i_n"); return; } switch((int)kind) { diff --git a/lang/pc/libpc/ini.c b/lang/pc/libpc/ini.c index 774846493..cc139d578 100644 --- a/lang/pc/libpc/ini.c +++ b/lang/pc/libpc/ini.c @@ -29,7 +29,7 @@ extern int _gtty(); struct file **_extfl; int _extflc; /* number of external files */ -char *_m_lb; /* LB of m_a_i_n */ +char *_m_lb; /* LB of _m_a_i_n */ struct file *_curfil; /* points to file struct in case of errors */ int _pargc; char **_pargv; diff --git a/mach/6500/libem/head_em.s b/mach/6500/libem/head_em.s index 49a6ad4ad..5e4a1c267 100644 --- a/mach/6500/libem/head_em.s +++ b/mach/6500/libem/head_em.s @@ -99,7 +99,7 @@ UNSIGN : .space 1 ! is it signed or unsigned arithmetic TRAPVAL: .space 1 ! intermediate storage of the error number STACK: .space 1 ! contains the hardware stackpointer on - ! entering m_a_i_n for a neat return + ! entering _m_a_i_n for a neat return RESERVED: .space 112 ! used by the operating system @@ -174,7 +174,7 @@ start: lda #0 ldx #1 jsr Push ! push argc - jsr _m_a_i_n ! start the real program + jsr __m_a_i_n ! start the real program lda #0x0FF jsr WRCH ! send end of program to R423 diff --git a/mach/arm/libem/head_em.s b/mach/arm/libem/head_em.s index f8f853059..26040b600 100644 --- a/mach/arm/libem/head_em.s +++ b/mach/arm/libem/head_em.s @@ -140,7 +140,7 @@ next3: ADR R11, argc LDR R11,[R11] STMFD R12<,{R11} - BAL.L _m_a_i_n + BAL.L __m_a_i_n MOV R11,#0 STMFD R12<,{R11} MOV R11,#1 diff --git a/mach/i386/libsys/head_em.s b/mach/i386/libsys/head_em.s index a69785c66..6d28f819c 100644 --- a/mach/i386/libsys/head_em.s +++ b/mach/i386/libsys/head_em.s @@ -1,9 +1,8 @@ .sect .text; .sect .rom; .sect .data; .sect .bss -.define begtext,begdata,begbss,syscal +.define begtext,begdata,begbss .define hol0,.reghp,.limhp,.trppc,.ignmask .define ERANGE,ESET,EHEAP,ECASE,EILLINS,EIDIVZ,EODDZ -.extern _end ERANGE = 1 ESET = 2 @@ -35,7 +34,7 @@ begtext: push ax push bx push cx - call _m_a_i_n + call __m_a_i_n push ax call __exit .sect .data diff --git a/mach/i80/libmon/head_em.s b/mach/i80/libmon/head_em.s index 2e28aff9d..82f22b5cc 100644 --- a/mach/i80/libmon/head_em.s +++ b/mach/i80/libmon/head_em.s @@ -35,7 +35,7 @@ push h lxi h,0 push h - call _m_a_i_n + call __m_a_i_n .stop: jmp 0xfb52 .sect .bss diff --git a/mach/i86/libsys/head_em.s b/mach/i86/libsys/head_em.s index 35fbcd301..dc002bb6c 100644 --- a/mach/i86/libsys/head_em.s +++ b/mach/i86/libsys/head_em.s @@ -26,7 +26,7 @@ begtext: push bx push cx xor bp,bp - call _m_a_i_n + call __m_a_i_n int 0x81 .sect .data begdata: diff --git a/mach/m68020/libsys/head_em.s b/mach/m68020/libsys/head_em.s index f69fdb87c..76c82306c 100644 --- a/mach/m68020/libsys/head_em.s +++ b/mach/m68020/libsys/head_em.s @@ -43,7 +43,7 @@ begtext: move.l a0,(8,sp) ! env ! move.l a0, environ ! indir is 0 if no env; not 0 if env ! jsr (initfpu) ! call to dummy floating point init routine - jsr (_m_a_i_n) + jsr (__m_a_i_n) move.l d0,(sp) ! no stack cleanup needed EXIT: jsr (__exit) diff --git a/mach/m68k2/README b/mach/m68k2/README index 777f929d5..ef55248fc 100644 --- a/mach/m68k2/README +++ b/mach/m68k2/README @@ -1,9 +1,6 @@ The m68k2 back end is an EM code generator for the Motorola MC68000. It defines an integer to be 16 bits and a pointer to be 32 bits. -At present it does not support floating point operations. -(All EM floating point instructions are translated to the -68000 "trap" instruction.) The m68k2 back end generates code for the ACK 68000 assembler. (The mnemonics recognized by this assembler can be found in "as/mach3.c"). @@ -32,17 +29,16 @@ on the kind of target 68000 system. ACK a.out format to your a.out format (as defined in "/usr/include/a.out.h"). The program "cv/cv.c" does the job for UniSoft Unix. It probably need only be slightly - modified for your system. Note that the program - generates no text or bss segments, but only a data segment. + modified for your system. If your target 68000 does not run Unix, but is e.g. a stand alone 68000, you will need a program to download the ACK a.out file. The program "dl/dl.c" produces Intel Hex format on standard output from an a.out file. - The EM runtime start-off ("libsys/head_em.s") may have to be modified. - It should call the procedure _m_a_i_n with parameters (argc,argv,envp). + It should call the procedure __m_a_i_n with parameters (argc,argv,envp). Usually, Unix will put these on top of the stack before starting the program. Note, however, that for 4-byte systems Unix will provide - a 4-byte argc, while _m_a_i_n expects a 2-byte argc; so the value + a 4-byte argc, while __m_a_i_n expects a 2-byte argc; so the value must be shortened to 2 bytes. diff --git a/mach/m68k2/libsys/head_em.s b/mach/m68k2/libsys/head_em.s index b761b8fec..3b90f7eea 100644 --- a/mach/m68k2/libsys/head_em.s +++ b/mach/m68k2/libsys/head_em.s @@ -51,7 +51,7 @@ begtext: ! envp pointer. add.l #2,sp !convert argc from 4-byte to 2-byte - jsr _m_a_i_n + jsr __m_a_i_n add #010,sp EXIT: move.w d0,-(sp) diff --git a/mach/m68k4/libsys/head_em.s b/mach/m68k4/libsys/head_em.s index 6e08c707b..3964e620a 100644 --- a/mach/m68k4/libsys/head_em.s +++ b/mach/m68k4/libsys/head_em.s @@ -50,7 +50,7 @@ begtext: ! Now the stack contains an argc (4 bytes), argv-pointer and ! envp pointer. - jsr _m_a_i_n + jsr __m_a_i_n add #012,sp EXIT: move.l d0,-(sp) diff --git a/mach/mantra/int/mloop0 b/mach/mantra/int/mloop0 index 16641faa3..16f822e91 100644 --- a/mach/mantra/int/mloop0 +++ b/mach/mantra/int/mloop0 @@ -1,5 +1,5 @@ .define filb - .define _m_a_i_n + .define __m_a_i_n .define curproc .define pd .define nproc @@ -25,7 +25,7 @@ ! START OF THE PROGRAM !--------------------------------------------------------------------------- -_m_a_i_n: +__m_a_i_n: #ifdef __BSD4_2 jsr getmask #endif diff --git a/mach/mantra/libsys/head_em.s b/mach/mantra/libsys/head_em.s index 41ff52085..b878d6491 100644 --- a/mach/mantra/libsys/head_em.s +++ b/mach/mantra/libsys/head_em.s @@ -50,7 +50,7 @@ begtext: ! Now the stack contains an argc (4 bytes), argv-pointer and ! envp pointer. - jsr _m_a_i_n + jsr __m_a_i_n add #012,sp EXIT: move.l d0,-(sp) diff --git a/mach/minix/libsys/head_em.s b/mach/minix/libsys/head_em.s index fc4ac4857..83a665ab6 100644 --- a/mach/minix/libsys/head_em.s +++ b/mach/minix/libsys/head_em.s @@ -25,7 +25,7 @@ begtext: push bx push cx xor bp,bp - call _m_a_i_n + call __m_a_i_n add sp,6 call __exit .sect .data diff --git a/mach/minixST/libsys/head_em.s b/mach/minixST/libsys/head_em.s index 7320365e8..a771de84a 100644 --- a/mach/minixST/libsys/head_em.s +++ b/mach/minixST/libsys/head_em.s @@ -37,11 +37,11 @@ begtext: move.l a1,-(sp) ! push environ move.l a0,-(sp) ! push argv move.w d0,-(sp) ! push argc - jsr _m_a_i_n + jsr __m_a_i_n add #010,sp EXIT: move.w d0,-(sp) - jsr _exit + jsr __exit L0: bra L0 .sect .data diff --git a/mach/ns/libsys/head_em.s b/mach/ns/libsys/head_em.s index 00ec9ac0b..01bd631f4 100644 --- a/mach/ns/libsys/head_em.s +++ b/mach/ns/libsys/head_em.s @@ -27,7 +27,7 @@ ECASE = 20 movd envp,tos movd argv,tos movd 1,tos - jsr @_m_a_i_n + jsr @__m_a_i_n .stop: movb 0x7f,tos jsr @.putchar diff --git a/mach/pdp/libem/head_em.s b/mach/pdp/libem/head_em.s index 3ea2f995d..00900d172 100644 --- a/mach/pdp/libem/head_em.s +++ b/mach/pdp/libem/head_em.s @@ -44,7 +44,7 @@ ECASE = 024 tst -(r0) 1: mov r0,4(sp) - jsr pc,_m_a_i_n + jsr pc,__m_a_i_n ! next two lines for as long as tail needs printf ! mov r0,-(sp) ! jsr pc,*$_exit diff --git a/mach/pmds/libsys/head_em.s b/mach/pmds/libsys/head_em.s index 6c7f1155e..ff3bf4453 100644 --- a/mach/pmds/libsys/head_em.s +++ b/mach/pmds/libsys/head_em.s @@ -1,6 +1,5 @@ -.define CERASE,CKILL,CSTOP,CSTART .define .lino,.filn -.define F_DUM,EXIT +.define EXIT .define begtext,begdata,begbss .define EARRAY,ERANGE,ESET,EIDIVZ,EHEAP,EILLINS,ECASE .define hol0,.reghp,.limhp,.trpim,.trppc @@ -14,13 +13,6 @@ -CERASE = 010 -CKILL = 030 -CSTART = 021 -CSTOP = 023 -F_DUM = 0 - - LINO_AD = 0 FILN_AD = 4 @@ -35,7 +27,7 @@ ECASE = 20 .sect .text begtext: add.l #2,sp !convert argc from 4-byte to 2-byte - jsr _m_a_i_n + jsr __m_a_i_n add #010,sp EXIT: move.w d0,-(sp) diff --git a/mach/pmds4/libsys/head_em.s b/mach/pmds4/libsys/head_em.s index a91e5fb7d..4bed638db 100644 --- a/mach/pmds4/libsys/head_em.s +++ b/mach/pmds4/libsys/head_em.s @@ -34,7 +34,7 @@ ECASE = 20 .sect .text begtext: - jsr _m_a_i_n + jsr __m_a_i_n add #012,sp EXIT: diff --git a/mach/sun2/libsys/head_em.s b/mach/sun2/libsys/head_em.s index 06b6174a0..e0f8a3892 100644 --- a/mach/sun2/libsys/head_em.s +++ b/mach/sun2/libsys/head_em.s @@ -38,10 +38,10 @@ begtext: pea (a0) move.l d2,-(sp) move.l #0,a6 - jsr _m_a_i_n + jsr __m_a_i_n move.l d0,(sp) ! no stack cleanup needed EXIT: - jsr _exit + jsr __exit .sect .data begdata: diff --git a/mach/sun3/libce/head_em.s b/mach/sun3/libce/head_em.s index f4543e6ca..3710be3af 100644 --- a/mach/sun3/libce/head_em.s +++ b/mach/sun3/libce/head_em.s @@ -40,10 +40,10 @@ begtext: move.l d2,-(sp) move.l #0,a6 jsr (fsoft_used) - jsr (_m_a_i_n) + jsr (__m_a_i_n) move.l d0,(sp) ! no stack cleanup needed EXIT: - jsr (_exit) + jsr (__exit) fsoft_used: start_float: diff --git a/mach/sun3/libsys/head_em.s b/mach/sun3/libsys/head_em.s index 36dd0b3f9..bc219095a 100644 --- a/mach/sun3/libsys/head_em.s +++ b/mach/sun3/libsys/head_em.s @@ -38,10 +38,10 @@ begtext: pea (a0) move.l d2,-(sp) move.l #0,a6 - jsr (_m_a_i_n) + jsr (__m_a_i_n) move.l d0,(sp) ! no stack cleanup needed EXIT: - jsr (_exit) + jsr (__exit) .sect .data begdata: diff --git a/mach/vax4/libbsd4_1a/head_em.s b/mach/vax4/libbsd4_1a/head_em.s index 04686a496..24808a8e6 100644 --- a/mach/vax4/libbsd4_1a/head_em.s +++ b/mach/vax4/libbsd4_1a/head_em.s @@ -28,7 +28,7 @@ pushl r0 pushl r2 pushl r1 - calls $3,_m_a_i_n + calls $3,__m_a_i_n movl $Im2,ap movl r0,6(ap) chmk (ap)+ diff --git a/mach/vax4/libbsd4_2/head_em.s b/mach/vax4/libbsd4_2/head_em.s index 87cac8855..861c0d23c 100644 --- a/mach/vax4/libbsd4_2/head_em.s +++ b/mach/vax4/libbsd4_2/head_em.s @@ -28,7 +28,7 @@ pushl r0 pushl r2 pushl r1 - calls $3,_m_a_i_n + calls $3,__m_a_i_n movl $Im2,ap movl r0,6(ap) chmk (ap)+ diff --git a/mach/vax4/libsysV_2/head_em.s b/mach/vax4/libsysV_2/head_em.s index 04686a496..24808a8e6 100644 --- a/mach/vax4/libsysV_2/head_em.s +++ b/mach/vax4/libsysV_2/head_em.s @@ -28,7 +28,7 @@ pushl r0 pushl r2 pushl r1 - calls $3,_m_a_i_n + calls $3,__m_a_i_n movl $Im2,ap movl r0,6(ap) chmk (ap)+ diff --git a/mach/xenix3/libsys/head_em.s b/mach/xenix3/libsys/head_em.s index 2949f0594..5cb0d6f5e 100644 --- a/mach/xenix3/libsys/head_em.s +++ b/mach/xenix3/libsys/head_em.s @@ -3,7 +3,7 @@ .define begtext,begdata,begbss,syscal .define hol0,.reghp,.limhp,.trppc,.ignmask .define ERANGE,ESET,EHEAP,ECASE,EILLINS,EIDIVZ,EODDZ -.extern _end +.extern endbss ERANGE = 1 ESET = 2 @@ -42,7 +42,7 @@ begtext: push bx push cx xor bp,bp - mov bx,_end + mov bx,endbss mov cx,9 add bx,1024 shr bx,cl @@ -50,11 +50,11 @@ begtext: call grow xor cx,cx push cx - call _sbrk + call __sbrk mov (.limhp),ax mov (.reghp),ax ! on Xenix, heap begins above stack! pop ax - call _m_a_i_n + call __m_a_i_n push ax call __exit .sect .data diff --git a/mach/z80/libmon/head_em.s b/mach/z80/libmon/head_em.s index 773d637da..1ecb7427c 100644 --- a/mach/z80/libmon/head_em.s +++ b/mach/z80/libmon/head_em.s @@ -44,7 +44,7 @@ push bc ld bc,1 push bc - call _m_a_i_n + call __m_a_i_n jp 0x20 diff --git a/mach/z80/libsys/head_em.s b/mach/z80/libsys/head_em.s index 773d637da..1ecb7427c 100644 --- a/mach/z80/libsys/head_em.s +++ b/mach/z80/libsys/head_em.s @@ -44,7 +44,7 @@ push bc ld bc,1 push bc - call _m_a_i_n + call __m_a_i_n jp 0x20 diff --git a/mach/z8000/libem/head_em.s b/mach/z8000/libem/head_em.s index fa8e20a04..5be73c5f0 100644 --- a/mach/z8000/libem/head_em.s +++ b/mach/z8000/libem/head_em.s @@ -39,7 +39,7 @@ EBADMON = 25 push *RR14, envp push *RR14, argv push *RR14, $1 - calr _m_a_i_n + calr __m_a_i_n ldl RR14, $0xC00017FC sc $0 diff --git a/util/ass/ass00.h b/util/ass/ass00.h index 5f48c283b..1f6b89914 100644 --- a/util/ass/ass00.h +++ b/util/ass/ass00.h @@ -219,7 +219,7 @@ struct rel { /* for relocation tables */ #define DATA_BYTES 9 /* name of procedure to be called first */ -#define MAIN "m_a_i_n" +#define MAIN "_m_a_i_n" /* headers of datablocks written */ #define HEADREP 0