Commit 38020095 authored by Russ Cox's avatar Russ Cox

Forgot to check in 386/asm.h.

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
parent da5e962e
...@@ -93,7 +93,7 @@ nuke: ...@@ -93,7 +93,7 @@ nuke:
rm -f *.[568] *.a $(GOROOT)/lib/$(LIB) rm -f *.[568] *.a $(GOROOT)/lib/$(LIB)
clean: clean:
rm -f *.[568] *.a runtime.acid cgo2c rm -f *.[568] *.a runtime.acid cgo2c */asm.h
%.$O: %.go %.$O: %.go
$(GC) $< $(GC) $<
...@@ -129,3 +129,7 @@ runtime.acid: runtime.h proc.c ...@@ -129,3 +129,7 @@ runtime.acid: runtime.h proc.c
chan.acid: runtime.h chan.c chan.acid: runtime.h chan.c
$(CC) -a chan.c >chan.acid $(CC) -a chan.c >chan.acid
$(GOARCH)/asm.h: runtime.acid mkasmh
mkasmh >$@.x
mv -f $@.x $@
// 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
...@@ -143,24 +143,24 @@ TEXT sys·lessstack(SB), 7, $0 ...@@ -143,24 +143,24 @@ TEXT sys·lessstack(SB), 7, $0
// morestack trampolines // morestack trampolines
TEXT sys·morestack00+0(SB),7,$0 TEXT sys·morestack00+0(SB),7,$0
MOVQ $0, AX MOVQ $0, AX
MOVQ AX, m_morearg(m) MOVQ AX, m_moreframe(m)
MOVQ $sys·morestack+0(SB), AX MOVQ $sys·morestack+0(SB), AX
JMP AX JMP AX
TEXT sys·morestack01+0(SB),7,$0 TEXT sys·morestack01+0(SB),7,$0
SHLQ $32, AX SHLQ $32, AX
MOVQ AX, m_morearg(m) MOVQ AX, m_moreframe(m)
MOVQ $sys·morestack+0(SB), AX MOVQ $sys·morestack+0(SB), AX
JMP AX JMP AX
TEXT sys·morestack10+0(SB),7,$0 TEXT sys·morestack10+0(SB),7,$0
MOVLQZX AX, AX MOVLQZX AX, AX
MOVQ AX, m_morearg(m) MOVQ AX, m_moreframe(m)
MOVQ $sys·morestack+0(SB), AX MOVQ $sys·morestack+0(SB), AX
JMP AX JMP AX
TEXT sys·morestack11+0(SB),7,$0 TEXT sys·morestack11+0(SB),7,$0
MOVQ AX, m_morearg(m) MOVQ AX, m_moreframe(m)
MOVQ $sys·morestack+0(SB), AX MOVQ $sys·morestack+0(SB), AX
JMP AX JMP AX
...@@ -199,7 +199,7 @@ TEXT sys·morestack48(SB),7,$0 ...@@ -199,7 +199,7 @@ TEXT sys·morestack48(SB),7,$0
TEXT sys·morestackx(SB),7,$0 TEXT sys·morestackx(SB),7,$0
POPQ AX POPQ AX
SHLQ $35, AX SHLQ $35, AX
MOVQ AX, m_morearg(m) MOVQ AX, m_moreframe(m)
MOVQ $sys·morestack(SB), AX MOVQ $sys·morestack(SB), AX
JMP AX JMP AX
......
#!/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
...@@ -134,23 +134,17 @@ struct Array ...@@ -134,23 +134,17 @@ struct Array
}; };
struct Gobuf struct Gobuf
{ {
// Offsets of fields in this struct are known to assembly. // The offsets of these fields are known to (hard-coded in) libmach.
// Any changes made here must be reflected in */asm.h.
// The debuggers also know the layout of this struct.
byte* sp; byte* sp;
byte* pc; byte* pc;
G* g; G* g;
}; };
struct G struct G
{ {
// Offsets of fields in this block are known to assembly. byte* stackguard; // cannot move - also known to linker, libmach
// Any changes made here must be reflected in */asm.h. byte* stackbase; // cannot move - also known to libmach
byte* stackguard; // cannot move - also known to linker, debuggers
byte* stackbase; // cannot move - also known to debuggers
Defer* defer; Defer* defer;
Gobuf sched; // cannot move - also known to debuggers Gobuf sched; // cannot move - also known to libmach
// Fields not known to assembly.
byte* stack0; // first stack segment byte* stack0; // first stack segment
byte* entry; // initial function byte* entry; // initial function
G* alllink; // on allg G* alllink; // on allg
...@@ -171,14 +165,12 @@ struct Mem ...@@ -171,14 +165,12 @@ struct Mem
}; };
struct M struct M
{ {
// Offsets of fields in this block are known to assembly. // The offsets of these fields are known to (hard-coded in) libmach.
// Any changes made here must be reflected in */asm.h.
// These are known to debuggers.
G* g0; // goroutine with scheduling stack G* g0; // goroutine with scheduling stack
void (*morepc)(void); void (*morepc)(void);
Gobuf morebuf; // gobuf arg to morestack 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 moreframe; // size arguments to morestack
uint32 moreargs; uint32 moreargs;
uintptr cret; // return value from C uintptr cret; // return value from C
...@@ -187,8 +179,6 @@ struct M ...@@ -187,8 +179,6 @@ struct M
uint32 tls[8]; // thread-local storage (for 386 extern register) uint32 tls[8]; // thread-local storage (for 386 extern register)
Gobuf sched; // scheduling stack Gobuf sched; // scheduling stack
G* curg; // current running goroutine G* curg; // current running goroutine
// Fields not known to assembly.
int32 id; int32 id;
int32 mallocing; int32 mallocing;
int32 gcing; int32 gcing;
...@@ -202,7 +192,7 @@ struct M ...@@ -202,7 +192,7 @@ struct M
}; };
struct Stktop 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* stackguard;
uint8* stackbase; uint8* stackbase;
Gobuf gobuf; Gobuf gobuf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment