Cleanups; take advantage of gcc asm() features.
authorDonn Seeley <donn@ucbvax.Berkeley.EDU>
Mon, 29 Apr 1991 03:19:03 +0000 (19:19 -0800)
committerDonn Seeley <donn@ucbvax.Berkeley.EDU>
Mon, 29 Apr 1991 03:19:03 +0000 (19:19 -0800)
SCCS-vsn: lib/csu/i386/crt0.c 5.4
SCCS-vsn: lib/csu/i386/crt0.c 5.4

usr/src/lib/csu/i386/crt0.c

index e3d6560..67bb0a9 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)crt0.c     5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)crt0.c     5.4 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 /*
 #endif /* LIBC_SCCS and not lint */
 
 /*
@@ -21,12 +21,13 @@ static char sccsid[] = "@(#)crt0.c  5.3 (Berkeley) %G%";
 char **environ = (char **)0;
 static int fd;
 
 char **environ = (char **)0;
 static int fd;
 
-asm("#define _start start");
-asm("#define _eprol eprol");
-asm("  .text");
-asm("  .long 0xc000c000");
+asm(".text");
+asm(".long 0xc000c000");
+
 extern unsigned char   etext;
 extern unsigned char   etext;
-extern unsigned char   eprol;
+extern unsigned char   eprol asm ("eprol");
+extern                 start() asm("start");
+
 start()
 {
        struct kframe {
 start()
 {
        struct kframe {
@@ -47,7 +48,7 @@ start()
        kfp = 0;
        initcode = initcode = 0;
 #else not lint
        kfp = 0;
        initcode = initcode = 0;
 #else not lint
-       asm("   lea     4(%ebp),%ebx"); /* catch it quick */
+       asm("lea 4(%ebp),%ebx");        /* catch it quick */
 #endif not lint
        for (argv = targv = &kfp->kargv[0]; *targv++; /* void */)
                /* void */ ;
 #endif not lint
        for (argv = targv = &kfp->kargv[0]; *targv++; /* void */)
                /* void */ ;
@@ -77,19 +78,17 @@ asm("eprol:");
        errno = 0;
        exit(main(kfp->kargc, argv, environ));
 }
        errno = 0;
        exit(main(kfp->kargc, argv, environ));
 }
-asm("#undef _start");
-asm("#undef _eprol");
 
 #ifdef MCRT0
 /*ARGSUSED*/
 exit(code)
 
 #ifdef MCRT0
 /*ARGSUSED*/
 exit(code)
-       register int code;      /* r11 */
+       register int code;
 {
        monitor(0);
        _cleanup();
 {
        monitor(0);
        _cleanup();
-       asm("   pushl   8(bp)") ;
-       asm("   movl $1,%eax");
-       asm("   .byte 0x9a; .long 0; .word 0");
+       asm("pushl 8(%ebp)") ;
+       asm("movl $1,%eax");
+       asm(".byte 0x9a; .long 0; .word 0");
 }
 #endif MCRT0
 
 }
 #endif MCRT0
 
@@ -103,6 +102,6 @@ moncontrol(val)
 {
 
 }
 {
 
 }
-asm("  .globl  mcount");
-asm("mcount:   ret");
+asm(".globl mcount");
+asm("mcount: ret");
 #endif CRT0
 #endif CRT0