aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2008-09-22 13:47:59 -0700
committerRuss Cox <rsc@golang.org>2008-09-22 13:47:59 -0700
commitebd1eef41e656b47cc7ecf2ae8ec64b40da8136a (patch)
treed1aaf712096222462f39963c52f507dde7eb3314
parentfb40f88c409da18ee69a7450e1b8f9528f3538ee (diff)
downloadgo-ebd1eef41e656b47cc7ecf2ae8ec64b40da8136a.tar.xz
implement spec: when main.main returns, the program exits
R=r DELTA=9 (7 added, 2 deleted, 0 changed) OCL=15628 CL=15643
-rw-r--r--src/runtime/rt0_amd64.s9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/runtime/rt0_amd64.s b/src/runtime/rt0_amd64.s
index 9f354a71ae..35448e07cc 100644
--- a/src/runtime/rt0_amd64.s
+++ b/src/runtime/rt0_amd64.s
@@ -37,13 +37,14 @@ TEXT _rt0_amd64(SB),7,$-8
CALL schedinit(SB)
// create a new goroutine to start program
-
PUSHQ $mainstart(SB) // entry
PUSHQ $16 // arg size
CALL sys·newproc(SB)
- CALL mstart(SB)
POPQ AX
POPQ AX
+
+ // start this M
+ CALL mstart(SB)
CALL notok(SB) // never returns
RET
@@ -52,6 +53,10 @@ TEXT mainstart(SB),7,$0
CALL main·init_function(SB)
CALL initdone(SB)
CALL main·main(SB)
+ PUSHQ $0
+ CALL sys·exit(SB)
+ POPQ AX
+ CALL notok(SB)
RET
TEXT sys·breakpoint(SB),7,$0