summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/v850/crt0.S
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/v850/crt0.S')
-rw-r--r--libc/sysdeps/linux/v850/crt0.S19
1 files changed, 10 insertions, 9 deletions
diff --git a/libc/sysdeps/linux/v850/crt0.S b/libc/sysdeps/linux/v850/crt0.S
index 7bfa9e004..2013c3b54 100644
--- a/libc/sysdeps/linux/v850/crt0.S
+++ b/libc/sysdeps/linux/v850/crt0.S
@@ -1,8 +1,8 @@
/*
* libc/sysdeps/linux/v850/crt0.S -- Initial program entry point for linux/v850
*
- * Copyright (C) 2001 NEC Corporation
- * Copyright (C) 2001 Miles Bader <miles@gnu.org>
+ * Copyright (C) 2001,2002 NEC Corporation
+ * Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License. See the file COPYING.LIB in the main
@@ -25,20 +25,21 @@ C_ENTRY(start):
mov r7, r8 // Arg 2: envp
mov r6, r10 // skip argc elements to get envp start
-1: add 4, r8
- add -1, r10
- bp 1b
+ add 1, r10 // ...plus the NULL at the end of argv
+ shl 2, r10 // Convert to byte-count to skip
+ add r10, r8
// Zero bss area, since we can't rely upon any loader to do so
mov hilo(C_SYMBOL_NAME(edata)), ep
mov hilo(C_SYMBOL_NAME(end)), r10
-2: sst.w r0, 0[ep]
+2: cmp ep, r10
+ be 3f
+ sst.w r0, 0[ep]
add 4, ep
- cmp ep, r10
- bne 2b
+ br 2b
// Load CTBP register
- mov hilo(C_SYMBOL_NAME(_ctbp)), r19
+3: mov hilo(C_SYMBOL_NAME(_ctbp)), r19
ldsr r19, ctbp
// Load GP