From a6e031061b7d5dd240b0395e7395acf630ff79c9 Mon Sep 17 00:00:00 2001 From: Chung-Ju Wu Date: Sat, 5 Oct 2013 23:44:46 +0800 Subject: [PATCH 04/15] [nds32] Make sure we pass argc=argv=env=0 to main function. * libgloss/nds32/crt0.S: Set argc=argv=env=0. * libgloss/nds32/crt1.S: Ditto. --- libgloss/nds32/crt0.S | 7 +++++++ libgloss/nds32/crt1.S | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/libgloss/nds32/crt0.S b/libgloss/nds32/crt0.S index d12be76..97c02c5 100644 --- a/libgloss/nds32/crt0.S +++ b/libgloss/nds32/crt0.S @@ -94,6 +94,13 @@ _start: .L_call_main: + /* Prepare argc/argv/env for main function. + Since there is no operating system so far, + we set $r0, $r1, and $r2 to be zero. */ + movi $r0, 0 + movi $r1, 0 + movi $r2, 0 + /* Call 'main'. */ la $r15, main jral $r15 diff --git a/libgloss/nds32/crt1.S b/libgloss/nds32/crt1.S index 26aef5b..60c18c3 100644 --- a/libgloss/nds32/crt1.S +++ b/libgloss/nds32/crt1.S @@ -100,6 +100,12 @@ _start: exit() has been reached. */ la $r0, _fini jal atexit + /* Prepare argc/argv/env for main function. + Since there is no operating system so far, + we set $r0, $r1, and $r2 to be zero. */ + movi $r0, 0 + movi $r1, 0 + movi $r2, 0 /* Call 'main'. */ la $r15, main jral $r15 -- 1.9.0