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:
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 $@
// 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
// 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
......
#!/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
};
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;
......
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