File: start.S

package info (click to toggle)
dietlibc 0.34~cvs20160606-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 11,336 kB
  • sloc: ansic: 71,631; asm: 13,006; cpp: 1,860; makefile: 799; sh: 292; perl: 62
file content (55 lines) | stat: -rw-r--r-- 1,160 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
  Copyright (C) 2002 Thomas M. Ogrisegg

  This is free software. You can redistribute and
  modify it under the terms of the GNU General Public
  Public License.

  This file is part of the IA64-Port of the dietlibc

  start.S
    Implemenation of the _start startup function
*/

#include "dietfeatures.h"

.file "start.S"

.psr abi64
.psr lsb
.lsb

.text
.globl _start
.proc  _start

_start:
	alloc r2 = ar.pfs,0,0,7,0
	adds out1 = 16, sp    /* base arguments */
	movl gp = @gprel(0f)  /* base offset */
	;;
0:	
	ld8 out0 = [out1], 8  /* load argc and set argv */
	mov r9 = ip
	;;
	shladd out2=out0,3,out1	/* envp = argv+8*argc */
	sub gp = r9, gp       /* subtract program counter */
	;;
	addl r15 = @ltoff(environ#), gp /* offset to environ */
	adds out2 = 8, out2	/* envp += 8 */
	;;
	ld8  r14 = [r15]
	;;
	st8  [r14] = out2           /* store envp in environ */

#ifdef WANT_DYNAMIC
/* FIXME: dl_init parameter ??? */
	br.call.sptk.few rp = _dyn_start
#else
	br.call.sptk.few rp = CALL_IN_STARTCODE
#endif
	;;
	mov r32 = r8                /* store return code */
	br exit                     /* branch to exit */
.endp _start
.size _start, . - _start