]> Cypherpunks repositories - gostls13.git/commitdiff
Forgot to check in 386/asm.h.
authorRuss Cox <rsc@golang.org>
Wed, 17 Jun 2009 23:31:02 +0000 (16:31 -0700)
committerRuss Cox <rsc@golang.org>
Wed, 17 Jun 2009 23:31:02 +0000 (16:31 -0700)
Rather than do that, fix build by
generating asm.h automatically.

R=r
DELTA=97  (48 added, 36 deleted, 13 changed)
OCL=30449
CL=30452

src/pkg/runtime/Makefile
src/pkg/runtime/amd64/asm.h [deleted file]
src/pkg/runtime/amd64/asm.s
src/pkg/runtime/mkasmh [new file with mode: 0755]
src/pkg/runtime/runtime.h

index 498bf0bef13f893d1edc00955214e12cce456ddd..78e3cbffd9eeb94765291f34e91f0618dbb65159 100644 (file)
@@ -93,7 +93,7 @@ nuke:
        rm -f *.[568] *.a $(GOROOT)/lib/$(LIB)
 
 clean:
-       rm -f *.[568] *.a runtime.acid cgo2c
+       rm -f *.[568] *.a runtime.acid cgo2c */asm.h
 
 %.$O:  %.go
        $(GC) $<
@@ -129,3 +129,7 @@ runtime.acid: runtime.h proc.c
 chan.acid: runtime.h chan.c
        $(CC) -a chan.c >chan.acid
 
+$(GOARCH)/asm.h: runtime.acid mkasmh
+       mkasmh >$@.x
+       mv -f $@.x $@
+
diff --git a/src/pkg/runtime/amd64/asm.h b/src/pkg/runtime/amd64/asm.h
deleted file mode 100644 (file)
index c32da75..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Assembly constants
-
-#define        g       R15
-#define        m       R14
-
-// offsets in m
-#define        m_g0            0
-#define        m_morepc        8
-#define        m_morebuf       16
-#define        m_morearg       40
-#define        m_cret          48
-#define        m_procid        56
-#define        m_gsignal       64
-#define        m_tls           72
-#define        m_sched         104
-
-// offsets in gobuf
-#define        gobuf_sp        0
-#define        gobuf_pc        8
-#define        gobuf_g         16
-
-// offsets in g
-#define        g_stackguard    0
-#define        g_stackbase     8
-#define        g_defer         16
-#define        g_sched         24
index 825acc4657351bd7dddad945ffcef10d4d377e1a..539b1ab2af7575dad49993cfd0b51e6a50fff3b9 100644 (file)
@@ -143,24 +143,24 @@ TEXT sys·lessstack(SB), 7, $0
 // morestack trampolines
 TEXT   sys·morestack00+0(SB),7,$0
        MOVQ    $0, AX
-       MOVQ    AX, m_morearg(m)
+       MOVQ    AX, m_moreframe(m)
        MOVQ    $sys·morestack+0(SB), AX
        JMP     AX
 
 TEXT   sys·morestack01+0(SB),7,$0
        SHLQ    $32, AX
-       MOVQ    AX, m_morearg(m)
+       MOVQ    AX, m_moreframe(m)
        MOVQ    $sys·morestack+0(SB), AX
        JMP     AX
 
 TEXT   sys·morestack10+0(SB),7,$0
        MOVLQZX AX, AX
-       MOVQ    AX, m_morearg(m)
+       MOVQ    AX, m_moreframe(m)
        MOVQ    $sys·morestack+0(SB), AX
        JMP     AX
 
 TEXT   sys·morestack11+0(SB),7,$0
-       MOVQ    AX, m_morearg(m)
+       MOVQ    AX, m_moreframe(m)
        MOVQ    $sys·morestack+0(SB), AX
        JMP     AX
 
@@ -199,7 +199,7 @@ TEXT        sys·morestack48(SB),7,$0
 TEXT   sys·morestackx(SB),7,$0
        POPQ    AX
        SHLQ    $35, AX
-       MOVQ    AX, m_morearg(m)
+       MOVQ    AX, m_moreframe(m)
        MOVQ    $sys·morestack(SB), AX
        JMP     AX
 
diff --git a/src/pkg/runtime/mkasmh b/src/pkg/runtime/mkasmh
new file mode 100755 (executable)
index 0000000..02f73ca
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+set -e
+
+cat <<'EOF'
+// Assembly constants.
+// AUTOMATICALLY GENERATED BY mkasmh DURING BUILD
+
+EOF
+
+case "$GOARCH" in
+386)
+       echo '#define   g       0(FS)'
+       echo '#define   m       4(FS)'
+       ;;
+amd64)
+       echo '#define   g       R15'
+       echo '#define   m       R14'
+       ;;
+*)
+       echo 'unknown $GOARCH: '$GOARCH 1>&2
+       exit 1
+       ;;
+esac
+echo
+
+awk '
+/^aggr G$/ { aggr="g" }
+/^aggr M$/ { aggr = "m" }
+/^aggr Gobuf$/ { aggr = "gobuf" }
+/^}/ { aggr = "" }
+
+#      Gobuf 24 sched;
+#      'Y' 48 stack0;
+#      'Y' 56 entry;
+#      'A' G 64 alllink;
+aggr != "" && /^       / {
+       name=$NF;
+       sub(/;/, "", name);
+       offset=$(NF-1);
+       printf("#define %s_%s %s\n", aggr, name, offset);
+}
+' runtime.acid
+
index 59dba49d843b266c57387fd71662d44264ad5260..662fde75931db76eebbf75e54ca602d0305a5c6a 100644 (file)
@@ -134,23 +134,17 @@ struct    Array
 };
 struct Gobuf
 {
-       // Offsets of fields in this struct are known to assembly.
-       // Any changes made here must be reflected in */asm.h.
-       // The debuggers also know the layout of this struct.
+       // The offsets of these fields are known to (hard-coded in) libmach.
        byte*   sp;
        byte*   pc;
        G*      g;
 };
 struct G
 {
-       // Offsets of fields in this block are known to assembly.
-       // Any changes made here must be reflected in */asm.h.
-       byte*   stackguard;     // cannot move - also known to linker, debuggers
-       byte*   stackbase;      // cannot move - also known to debuggers
+       byte*   stackguard;     // cannot move - also known to linker, libmach
+       byte*   stackbase;      // cannot move - also known to libmach
        Defer*  defer;
-       Gobuf   sched;          // cannot move - also known to debuggers
-
-       // Fields not known to assembly.
+       Gobuf   sched;          // cannot move - also known to libmach
        byte*   stack0;         // first stack segment
        byte*   entry;          // initial function
        G*      alllink;        // on allg
@@ -171,14 +165,12 @@ struct    Mem
 };
 struct M
 {
-       // Offsets of fields in this block are known to assembly.
-       // Any changes made here must be reflected in */asm.h.
-       // These are known to debuggers.
+       // The offsets of these fields are known to (hard-coded in) libmach.
        G*      g0;             // goroutine with scheduling stack
        void    (*morepc)(void);
        Gobuf   morebuf;        // gobuf arg to morestack
 
-       // Known to assembly, but not to debuggers.
+       // Fields not known to debuggers.
        uint32  moreframe;      // size arguments to morestack
        uint32  moreargs;
        uintptr cret;           // return value from C
@@ -187,8 +179,6 @@ struct      M
        uint32  tls[8];         // thread-local storage (for 386 extern register)
        Gobuf   sched;  // scheduling stack
        G*      curg;           // current running goroutine
-
-       // Fields not known to assembly.
        int32   id;
        int32   mallocing;
        int32   gcing;
@@ -202,7 +192,7 @@ struct      M
 };
 struct Stktop
 {
-       // The debuggers know the layout of this struct.
+       // The offsets of these fields are known to (hard-coded in) libmach.
        uint8*  stackguard;
        uint8*  stackbase;
        Gobuf   gobuf;