head	1.3;
access;
symbols
	perseant-exfatfs-base-20250801:1.3
	perseant-exfatfs-base-20240630:1.3
	perseant-exfatfs:1.3.0.46
	perseant-exfatfs-base:1.3
	cjep_sun2x:1.3.0.44
	cjep_sun2x-base:1.3
	cjep_staticlib_x-base1:1.3
	cjep_staticlib_x:1.3.0.42
	cjep_staticlib_x-base:1.3
	phil-wifi-20200421:1.3
	phil-wifi-20200411:1.3
	phil-wifi-20200406:1.3
	pgoyette-compat-merge-20190127:1.3
	pgoyette-compat-20190127:1.3
	pgoyette-compat-20190118:1.3
	pgoyette-compat-1226:1.3
	pgoyette-compat-1126:1.3
	pgoyette-compat-1020:1.3
	pgoyette-compat-0930:1.3
	pgoyette-compat-0906:1.3
	pgoyette-compat-0728:1.3
	pgoyette-compat-0625:1.3
	pgoyette-compat-0521:1.3
	pgoyette-compat-0502:1.3
	pgoyette-compat-0422:1.3
	pgoyette-compat-0415:1.3
	pgoyette-compat-0407:1.3
	pgoyette-compat-0330:1.3
	pgoyette-compat-0322:1.3
	pgoyette-compat-0315:1.3
	pgoyette-compat:1.3.0.40
	pgoyette-compat-base:1.3
	perseant-stdc-iso10646:1.3.0.38
	perseant-stdc-iso10646-base:1.3
	prg-localcount2-base3:1.3
	prg-localcount2-base2:1.3
	prg-localcount2-base1:1.3
	prg-localcount2:1.3.0.36
	prg-localcount2-base:1.3
	pgoyette-localcount-20170426:1.3
	bouyer-socketcan-base1:1.3
	pgoyette-localcount-20170320:1.3
	bouyer-socketcan:1.3.0.34
	bouyer-socketcan-base:1.3
	pgoyette-localcount-20170107:1.3
	pgoyette-localcount-20161104:1.3
	localcount-20160914:1.3
	pgoyette-localcount-20160806:1.3
	pgoyette-localcount-20160726:1.3
	pgoyette-localcount:1.3.0.32
	pgoyette-localcount-base:1.3
	netbsd-5-2-3-RELEASE:1.3
	netbsd-5-1-5-RELEASE:1.3
	yamt-pagecache-base9:1.3
	yamt-pagecache-tag8:1.3
	tls-earlyentropy:1.3.0.28
	tls-earlyentropy-base:1.3
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.3
	riastradh-drm2-base3:1.3
	netbsd-5-2-2-RELEASE:1.3
	netbsd-5-1-4-RELEASE:1.3
	netbsd-5-2-1-RELEASE:1.3
	netbsd-5-1-3-RELEASE:1.3
	agc-symver:1.3.0.30
	agc-symver-base:1.3
	tls-maxphys-base:1.3
	yamt-pagecache-base8:1.3
	netbsd-5-2:1.3.0.26
	yamt-pagecache-base7:1.3
	netbsd-5-2-RELEASE:1.3
	netbsd-5-2-RC1:1.3
	yamt-pagecache-base6:1.3
	yamt-pagecache-base5:1.3
	yamt-pagecache-base4:1.3
	netbsd-5-1-2-RELEASE:1.3
	netbsd-5-1-1-RELEASE:1.3
	yamt-pagecache-base3:1.3
	yamt-pagecache-base2:1.3
	yamt-pagecache:1.3.0.24
	yamt-pagecache-base:1.3
	bouyer-quota2-nbase:1.3
	bouyer-quota2:1.3.0.22
	bouyer-quota2-base:1.3
	matt-nb5-pq3:1.3.0.20
	matt-nb5-pq3-base:1.3
	netbsd-5-1:1.3.0.18
	netbsd-5-1-RELEASE:1.3
	netbsd-5-1-RC4:1.3
	netbsd-5-1-RC3:1.3
	netbsd-5-1-RC2:1.3
	netbsd-5-1-RC1:1.3
	netbsd-5-0-2-RELEASE:1.3
	netbsd-5-0-1-RELEASE:1.3
	jym-xensuspend-nbase:1.3
	netbsd-5-0:1.3.0.16
	netbsd-5-0-RELEASE:1.3
	netbsd-5-0-RC4:1.3
	netbsd-5-0-RC3:1.3
	netbsd-5-0-RC2:1.3
	jym-xensuspend:1.3.0.14
	jym-xensuspend-base:1.3
	netbsd-5-0-RC1:1.3
	netbsd-5:1.3.0.12
	netbsd-5-base:1.3
	mjf-devfs2:1.3.0.10
	mjf-devfs2-base:1.3
	yamt-pf42-base4:1.3
	yamt-pf42-base3:1.3
	hpcarm-cleanup-nbase:1.3
	yamt-pf42-base2:1.3
	yamt-pf42:1.3.0.8
	yamt-pf42-base:1.3
	keiichi-mipv6:1.3.0.6
	keiichi-mipv6-base:1.3
	cube-autoconf:1.3.0.4
	cube-autoconf-base:1.3
	hpcarm-cleanup:1.3.0.2
	hpcarm-cleanup-base:1.3
	netbsd-1-3-PATCH003:1.2.2.2
	netbsd-1-3-PATCH003-CANDIDATE2:1.2.2.2
	netbsd-1-3-PATCH003-CANDIDATE1:1.2.2.2
	netbsd-1-3-PATCH003-CANDIDATE0:1.2.2.2
	netbsd-1-3-PATCH002:1.2.2.2
	netbsd-1-3:1.2.0.2;
locks; strict;
comment	@# @;


1.3
date	99.01.10.17.34.00;	author christos;	state dead;
branches;
next	1.2;

1.2
date	98.04.09.04.45.08;	author mhitch;	state Exp;
branches
	1.2.2.1;
next	1.1;

1.1
date	98.03.25.04.12.32;	author mhitch;	state Exp;
branches;
next	;

1.2.2.1
date	98.04.09.04.45.08;	author mycroft;	state dead;
branches;
next	1.2.2.2;

1.2.2.2
date	98.05.08.17.39.13;	author mycroft;	state Exp;
branches;
next	;


desc
@@


1.3
log
@Moved via repository copy to arch/mips
@
text
@/*	$NetBSD: rtld_start.S,v 1.2 1998/04/09 04:45:08 mhitch Exp $	*/

/*
 * Copyright 1997 Michael L. Hitch <mhitch@@montana.edu>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <machine/regdef.h>
#include <mips/asm.h>

LEAF(rtld_start)
	.set	noreorder

	.cpload t9
	addu	sp, sp, -12		# adjust stack pointer
	.cprestore 0			# 0(sp) for gp
					# 4(sp) for atexit
					# 8(sp) for obj_main
	move	s0,a0			# save stack pointer from a0
	addu	a0, sp, 4		# _rtld argument
	move	s1,a3			# save ps_strings pointer
	jal	_C_LABEL(_rtld)		# v0 = _rtld(sp)
	nop				# [BD if jal not expanded]
	lw	a1, 4(sp)		# our atexit function
	lw	a2, 8(sp)		# obj_main entry
	addu	sp, sp,12		# readjust stack
	move	a0,s0			# stack pointer
	move	t9,v0
	jr	t9			# _start(sp, cleanup, obj);
	move	a3,s1			# restore ps_strings

END(rtld_start)

	.globl	_rtld_bind_start
	.ent	_rtld_bind_start
_rtld_bind_start:

	move	v1,gp			# save old GP
	add	t9,8			# modify T9 to point at .cpload
	.cpload	t9
	subu	sp,40			# save arguments and sp value in stack
	.cprestore 32
	sw	t7,36(sp)
	sw	a0,12(sp)
	sw	a1,16(sp)
	sw	a2,20(sp)
	sw	a3,24(sp)
	sw	s0,28(sp)
	move	s0,sp
	move	a0,t8			# symbol index
	move	a1,t7			# old RA
	move	a2,v1			# old GP
	move	a3,ra			# current RA
	jal	_C_LABEL(_rtld_bind_mips)
	nop
	move	sp,s0
	lw	ra,36(sp)
	lw	a0,12(sp)
	lw	a1,16(sp)
	lw	a2,20(sp)
	lw	a3,24(sp)
	lw	s0,28(sp)
	addu	sp,40
	move	t9,v0
	jr	t9
	nop
	.end	_rtld_bind_start
@


1.2
log
@Oops - when assembled with PIC, the jal gets expanded, so what used to be
in the branch delay slot was no longer getting executed at the proper time.
This resulted in a corrupt ps_strings pointer and caused programs trying to
use ps_strings to fail.
@
text
@d1 1
a1 1
/*	$NetBSD: rtld_start.S,v 1.1 1998/03/25 04:12:32 mhitch Exp $	*/
@


1.2.2.1
log
@file rtld_start.S was added on branch netbsd-1-3 on 1998-05-08 17:39:13 +0000
@
text
@d1 89
@


1.2.2.2
log
@Sync with trunk, per request of mycroft.
@
text
@a0 89
/*	$NetBSD: rtld_start.S,v 1.2.2.1 1998/05/08 17:39:13 mycroft Exp $	*/

/*
 * Copyright 1997 Michael L. Hitch <mhitch@@montana.edu>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <machine/regdef.h>
#include <mips/asm.h>

LEAF(rtld_start)
	.set	noreorder

	.cpload t9
	addu	sp, sp, -12		# adjust stack pointer
	.cprestore 0			# 0(sp) for gp
					# 4(sp) for atexit
					# 8(sp) for obj_main
	move	s0,a0			# save stack pointer from a0
	addu	a0, sp, 4		# _rtld argument
	move	s1,a3			# save ps_strings pointer
	jal	_C_LABEL(_rtld)		# v0 = _rtld(sp)
	nop				# [BD if jal not expanded]
	lw	a1, 4(sp)		# our atexit function
	lw	a2, 8(sp)		# obj_main entry
	addu	sp, sp,12		# readjust stack
	move	a0,s0			# stack pointer
	move	t9,v0
	jr	t9			# _start(sp, cleanup, obj);
	move	a3,s1			# restore ps_strings

END(rtld_start)

	.globl	_rtld_bind_start
	.ent	_rtld_bind_start
_rtld_bind_start:

	move	v1,gp			# save old GP
	add	t9,8			# modify T9 to point at .cpload
	.cpload	t9
	subu	sp,40			# save arguments and sp value in stack
	.cprestore 32
	sw	t7,36(sp)
	sw	a0,12(sp)
	sw	a1,16(sp)
	sw	a2,20(sp)
	sw	a3,24(sp)
	sw	s0,28(sp)
	move	s0,sp
	move	a0,t8			# symbol index
	move	a1,t7			# old RA
	move	a2,v1			# old GP
	move	a3,ra			# current RA
	jal	_C_LABEL(_rtld_bind_mips)
	nop
	move	sp,s0
	lw	ra,36(sp)
	lw	a0,12(sp)
	lw	a1,16(sp)
	lw	a2,20(sp)
	lw	a3,24(sp)
	lw	s0,28(sp)
	addu	sp,40
	move	t9,v0
	jr	t9
	nop
	.end	_rtld_bind_start
@


1.1
log
@Add support for mips.
@
text
@d1 1
a1 1
/*	$NetBSD: $	*/
d43 1
d45 1
a45 1
	move	s1,a3			# save ps_strings pointer
@
