2009-06-17 17:31:02 -06:00
|
|
|
#!/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.
|
2009-08-13 15:23:35 -06:00
|
|
|
// AUTOMATICALLY GENERATED BY mkasmh.sh DURING BUILD
|
2009-06-17 17:31:02 -06:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
case "$GOARCH" in
|
|
|
|
386)
|
2009-10-03 11:37:12 -06:00
|
|
|
# The offsets 0 and 4 are also known to:
|
|
|
|
# nacl/thread.c:/^newosproc
|
|
|
|
# ../../cmd/8l/pass.c:/D_GS
|
|
|
|
# ../../libcgo/linux_386.c:/^start
|
|
|
|
# ../../libcgo/darwin_386.c:/^start
|
2010-01-06 18:58:55 -07:00
|
|
|
case "$GOOS" in
|
2010-04-30 00:45:14 -06:00
|
|
|
windows)
|
2010-01-06 18:58:55 -07:00
|
|
|
echo '#define get_tls(r) MOVL 0x2c(FS), r'
|
|
|
|
echo '#define g(r) 0(r)'
|
|
|
|
echo '#define m(r) 4(r)'
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo '#define get_tls(r)'
|
|
|
|
echo '#define g(r) 0(GS)'
|
|
|
|
echo '#define m(r) 4(GS)'
|
|
|
|
;;
|
|
|
|
esac
|
2009-06-17 17:31:02 -06:00
|
|
|
;;
|
|
|
|
amd64)
|
2009-10-03 11:37:12 -06:00
|
|
|
# These registers are also known to:
|
|
|
|
# ../../libcgo/linux_amd64.c:/^start
|
2009-06-17 17:31:02 -06:00
|
|
|
echo '#define g R15'
|
|
|
|
echo '#define m R14'
|
|
|
|
;;
|
2009-06-22 15:08:00 -06:00
|
|
|
arm)
|
|
|
|
echo '#define g R10'
|
|
|
|
echo '#define m R9'
|
|
|
|
echo '#define LR R14'
|
|
|
|
;;
|
2009-06-17 17:31:02 -06:00
|
|
|
*)
|
|
|
|
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);
|
|
|
|
}
|
2009-10-28 15:03:16 -06:00
|
|
|
' runtime.acid.$GOARCH
|
2009-06-17 17:31:02 -06:00
|
|
|
|