2009-12-17 17:08:42 -07:00
|
|
|
// 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.
|
|
|
|
|
2010-10-25 18:55:50 -06:00
|
|
|
// Software floating point interpretaton of ARM 7500 FP instructions.
|
|
|
|
// The interpretation is not bit compatible with the 7500.
|
|
|
|
// It uses true little-endian doubles, while the 7500 used mixed-endian.
|
|
|
|
|
2009-12-17 17:08:42 -07:00
|
|
|
#include "runtime.h"
|
|
|
|
|
2010-04-15 03:43:49 -06:00
|
|
|
void abort(void);
|
|
|
|
|
|
|
|
static void
|
|
|
|
fabort(void)
|
|
|
|
{
|
|
|
|
if (1) {
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf("Unsupported floating point instruction\n");
|
|
|
|
runtime·abort();
|
2010-04-15 03:43:49 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint32 doabort = 0;
|
|
|
|
static uint32 trace = 0;
|
|
|
|
|
|
|
|
static const int8* opnames[] = {
|
|
|
|
// binary
|
|
|
|
"adf",
|
|
|
|
"muf",
|
|
|
|
"suf",
|
|
|
|
"rsf",
|
|
|
|
"dvf",
|
|
|
|
"rdf",
|
|
|
|
"pow",
|
|
|
|
"rpw",
|
|
|
|
"rmf",
|
|
|
|
"fml",
|
|
|
|
"fdv",
|
|
|
|
"frd",
|
|
|
|
"pol",
|
|
|
|
"UNDEFINED",
|
|
|
|
"UNDEFINED",
|
|
|
|
"UNDEFINED",
|
|
|
|
|
|
|
|
// unary
|
|
|
|
"mvf",
|
|
|
|
"mnf",
|
|
|
|
"abs",
|
|
|
|
"rnd",
|
|
|
|
"sqt",
|
|
|
|
"log",
|
|
|
|
"lgn",
|
|
|
|
"exp",
|
|
|
|
"sin",
|
|
|
|
"cos",
|
|
|
|
"tan",
|
|
|
|
"asn",
|
|
|
|
"acs",
|
|
|
|
"atn",
|
|
|
|
"urd",
|
|
|
|
"nrm"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const int8* fpconst[] = {
|
|
|
|
"0.0", "1.0", "2.0", "3.0", "4.0", "5.0", "0.5", "10.0",
|
|
|
|
};
|
|
|
|
|
|
|
|
static const uint64 fpdconst[] = {
|
|
|
|
0x0000000000000000ll,
|
|
|
|
0x3ff0000000000000ll,
|
|
|
|
0x4000000000000000ll,
|
|
|
|
0x4008000000000000ll,
|
|
|
|
0x4010000000000000ll,
|
|
|
|
0x4014000000000000ll,
|
|
|
|
0x3fe0000000000000ll,
|
|
|
|
0x4024000000000000ll
|
|
|
|
};
|
|
|
|
|
|
|
|
static const int8* fpprec[] = {
|
|
|
|
"s", "d", "e", "?"
|
|
|
|
};
|
|
|
|
|
2009-12-17 17:08:42 -07:00
|
|
|
static uint32
|
2010-04-15 03:43:49 -06:00
|
|
|
precision(uint32 i)
|
|
|
|
{
|
|
|
|
switch (i&0x00080080) {
|
|
|
|
case 0:
|
|
|
|
return 0;
|
|
|
|
case 0x80:
|
|
|
|
return 1;
|
|
|
|
default:
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·fabort();
|
2010-04-15 03:43:49 -06:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint64
|
|
|
|
frhs(uint32 rhs)
|
|
|
|
{
|
|
|
|
if (rhs & 0x8) {
|
|
|
|
return fpdconst[rhs&0x7];
|
|
|
|
} else {
|
|
|
|
return m->freg[rhs&0x7];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-07-20 06:53:16 -06:00
|
|
|
fprint(void)
|
2009-12-17 17:08:42 -07:00
|
|
|
{
|
|
|
|
uint32 i;
|
2010-04-15 03:43:49 -06:00
|
|
|
for (i = 0; i < 8; i++) {
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf("\tf%d:\t%X\n", i, m->freg[i]);
|
2010-04-15 03:43:49 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint32
|
|
|
|
d2s(uint64 d)
|
|
|
|
{
|
2010-10-25 18:55:50 -06:00
|
|
|
uint32 x;
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·f64to32c(d, &x);
|
2010-10-25 18:55:50 -06:00
|
|
|
return x;
|
2010-04-15 03:43:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static uint64
|
|
|
|
s2d(uint32 s)
|
|
|
|
{
|
2010-10-25 18:55:50 -06:00
|
|
|
uint64 x;
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·f32to64c(s, &x);
|
2010-10-25 18:55:50 -06:00
|
|
|
return x;
|
2010-07-20 06:53:16 -06:00
|
|
|
}
|
|
|
|
|
2010-04-15 03:43:49 -06:00
|
|
|
// cdp, data processing instructions
|
|
|
|
static void
|
|
|
|
dataprocess(uint32* pc)
|
|
|
|
{
|
|
|
|
uint32 i, opcode, unary, dest, lhs, rhs, prec;
|
2010-10-25 18:55:50 -06:00
|
|
|
uint64 l, r;
|
|
|
|
uint64 fd;
|
2010-04-15 03:43:49 -06:00
|
|
|
i = *pc;
|
|
|
|
|
|
|
|
// data processing
|
|
|
|
opcode = i>>20 & 15;
|
|
|
|
unary = i>>15 & 1;
|
|
|
|
|
|
|
|
dest = i>>12 & 7;
|
|
|
|
lhs = i>>16 & 7;
|
|
|
|
rhs = i & 15;
|
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
prec = runtime·precision(i);
|
2010-07-20 06:53:16 -06:00
|
|
|
// if (prec != 1)
|
|
|
|
// goto undef;
|
|
|
|
|
2010-04-15 03:43:49 -06:00
|
|
|
if (unary) {
|
|
|
|
switch (opcode) {
|
|
|
|
case 0: // mvf
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
fd = runtime·frhs(rhs);
|
2010-10-20 22:56:20 -06:00
|
|
|
if(prec == 0)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
fd = runtime·s2d(d2s(fd));
|
2010-10-20 22:56:20 -06:00
|
|
|
m->freg[dest] = fd;
|
2010-04-15 03:43:49 -06:00
|
|
|
goto ret;
|
|
|
|
default:
|
|
|
|
goto undef;
|
|
|
|
}
|
|
|
|
} else {
|
2010-10-25 18:55:50 -06:00
|
|
|
l = m->freg[lhs];
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
r = runtime·frhs(rhs);
|
2010-04-15 03:43:49 -06:00
|
|
|
switch (opcode) {
|
|
|
|
default:
|
|
|
|
goto undef;
|
2010-10-25 18:55:50 -06:00
|
|
|
case 0:
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·fadd64c(l, r, &m->freg[dest]);
|
2010-10-25 18:55:50 -06:00
|
|
|
break;
|
|
|
|
case 1:
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·fmul64c(l, r, &m->freg[dest]);
|
2010-10-25 18:55:50 -06:00
|
|
|
break;
|
|
|
|
case 2:
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·fsub64c(l, r, &m->freg[dest]);
|
2010-10-25 18:55:50 -06:00
|
|
|
break;
|
|
|
|
case 4:
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·fdiv64c(l, r, &m->freg[dest]);
|
2010-10-25 18:55:50 -06:00
|
|
|
break;
|
2010-04-15 03:43:49 -06:00
|
|
|
}
|
2010-10-25 18:55:50 -06:00
|
|
|
goto ret;
|
2010-04-15 03:43:49 -06:00
|
|
|
}
|
|
|
|
|
2010-07-20 06:53:16 -06:00
|
|
|
|
2010-04-15 03:43:49 -06:00
|
|
|
undef:
|
|
|
|
doabort = 1;
|
|
|
|
|
|
|
|
ret:
|
|
|
|
if (trace || doabort) {
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf(" %p %x\t%s%s\tf%d, ", pc, *pc, opnames[opcode | unary<<4],
|
2010-04-15 03:43:49 -06:00
|
|
|
fpprec[prec], dest);
|
|
|
|
if (!unary)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf("f%d, ", lhs);
|
2010-04-15 03:43:49 -06:00
|
|
|
if (rhs & 0x8)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf("#%s\n", fpconst[rhs&0x7]);
|
2010-04-15 03:43:49 -06:00
|
|
|
else
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf("f%d\n", rhs&0x7);
|
|
|
|
runtime·fprint();
|
2010-04-15 03:43:49 -06:00
|
|
|
}
|
|
|
|
if (doabort)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·fabort();
|
2010-04-15 03:43:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#define CPSR 14
|
|
|
|
#define FLAGS_N (1 << 31)
|
|
|
|
#define FLAGS_Z (1 << 30)
|
|
|
|
#define FLAGS_C (1 << 29)
|
2010-07-20 06:53:16 -06:00
|
|
|
#define FLAGS_V (1 << 28)
|
2010-04-15 03:43:49 -06:00
|
|
|
|
|
|
|
// cmf, compare floating point
|
|
|
|
static void
|
2010-10-18 10:24:59 -06:00
|
|
|
compare(uint32 *pc, uint32 *regs)
|
|
|
|
{
|
2010-10-25 18:55:50 -06:00
|
|
|
uint32 i, flags, lhs, rhs;
|
|
|
|
uint64 l, r;
|
|
|
|
int32 cmp;
|
|
|
|
bool nan;
|
2010-04-15 03:43:49 -06:00
|
|
|
|
|
|
|
i = *pc;
|
|
|
|
flags = 0;
|
|
|
|
lhs = i>>16 & 0x7;
|
|
|
|
rhs = i & 0xf;
|
|
|
|
|
2010-10-25 18:55:50 -06:00
|
|
|
l = m->freg[lhs];
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
r = runtime·frhs(rhs);
|
|
|
|
runtime·fcmp64c(l, r, &cmp, &nan);
|
2010-10-25 18:55:50 -06:00
|
|
|
if (nan)
|
2010-07-20 06:53:16 -06:00
|
|
|
flags = FLAGS_C | FLAGS_V;
|
2010-10-25 18:55:50 -06:00
|
|
|
else if (cmp == 0)
|
2010-04-15 03:43:49 -06:00
|
|
|
flags = FLAGS_Z | FLAGS_C;
|
2010-10-25 18:55:50 -06:00
|
|
|
else if (cmp < 0)
|
2010-04-15 03:43:49 -06:00
|
|
|
flags = FLAGS_N;
|
2010-10-25 18:55:50 -06:00
|
|
|
else
|
2010-04-15 03:43:49 -06:00
|
|
|
flags = FLAGS_C;
|
|
|
|
|
|
|
|
if (trace) {
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf(" %p %x\tcmf\tf%d, ", pc, *pc, lhs);
|
2010-04-15 03:43:49 -06:00
|
|
|
if (rhs & 0x8)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf("#%s\n", fpconst[rhs&0x7]);
|
2010-04-15 03:43:49 -06:00
|
|
|
else
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf("f%d\n", rhs&0x7);
|
2010-04-15 03:43:49 -06:00
|
|
|
}
|
|
|
|
regs[CPSR] = regs[CPSR] & 0x0fffffff | flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ldf/stf, load/store floating
|
|
|
|
static void
|
|
|
|
loadstore(uint32 *pc, uint32 *regs)
|
|
|
|
{
|
|
|
|
uint32 i, isload, coproc, ud, wb, tlen, p, reg, freg, offset;
|
|
|
|
uint32 addr;
|
|
|
|
|
|
|
|
i = *pc;
|
|
|
|
coproc = i>>8&0xf;
|
|
|
|
isload = i>>20&1;
|
|
|
|
p = i>>24&1;
|
|
|
|
ud = i>>23&1;
|
2010-10-20 13:35:37 -06:00
|
|
|
tlen = i>>(22 - 1)&2 | i>>15&1;
|
2010-04-15 03:43:49 -06:00
|
|
|
wb = i>>21&1;
|
|
|
|
reg = i>>16 &0xf;
|
|
|
|
freg = i>>12 &0x7;
|
|
|
|
offset = (i&0xff) << 2;
|
|
|
|
|
|
|
|
if (coproc != 1 || p != 1 || wb != 0 || tlen > 1)
|
|
|
|
goto undef;
|
|
|
|
if (reg > 13)
|
|
|
|
goto undef;
|
|
|
|
|
|
|
|
if (ud)
|
|
|
|
addr = regs[reg] + offset;
|
|
|
|
else
|
|
|
|
addr = regs[reg] - offset;
|
|
|
|
|
|
|
|
if (isload)
|
|
|
|
if (tlen)
|
|
|
|
m->freg[freg] = *((uint64*)addr);
|
|
|
|
else
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
m->freg[freg] = runtime·s2d(*((uint32*)addr));
|
2010-04-15 03:43:49 -06:00
|
|
|
else
|
|
|
|
if (tlen)
|
|
|
|
*((uint64*)addr) = m->freg[freg];
|
|
|
|
else
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
*((uint32*)addr) = runtime·d2s(m->freg[freg]);
|
2010-04-15 03:43:49 -06:00
|
|
|
goto ret;
|
|
|
|
|
|
|
|
undef:
|
|
|
|
doabort = 1;
|
|
|
|
|
|
|
|
ret:
|
|
|
|
if (trace || doabort) {
|
|
|
|
if (isload)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf(" %p %x\tldf", pc, *pc);
|
2010-04-15 03:43:49 -06:00
|
|
|
else
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf(" %p %x\tstf", pc, *pc);
|
|
|
|
runtime·printf("%s\t\tf%d, %s%d(r%d)", fpprec[tlen], freg, ud ? "" : "-", offset, reg);
|
|
|
|
runtime·printf("\t\t// %p", regs[reg] + (ud ? offset : -offset));
|
2010-04-15 03:43:49 -06:00
|
|
|
if (coproc != 1 || p != 1 || wb != 0)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf(" coproc: %d pre: %d wb %d", coproc, p, wb);
|
|
|
|
runtime·printf("\n");
|
|
|
|
runtime·fprint();
|
2010-04-15 03:43:49 -06:00
|
|
|
}
|
|
|
|
if (doabort)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·fabort();
|
2010-04-15 03:43:49 -06:00
|
|
|
}
|
|
|
|
|
2010-07-20 06:53:16 -06:00
|
|
|
static void
|
|
|
|
fltfix(uint32 *pc, uint32 *regs)
|
|
|
|
{
|
2010-10-25 18:55:50 -06:00
|
|
|
uint32 i, toarm, freg, reg, prec;
|
|
|
|
int64 val;
|
|
|
|
uint64 f0;
|
|
|
|
bool ok;
|
2010-07-20 06:53:16 -06:00
|
|
|
|
|
|
|
i = *pc;
|
|
|
|
toarm = i>>20 & 0x1;
|
|
|
|
freg = i>>16 & 0x7;
|
|
|
|
reg = i>>12 & 0xf;
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
prec = runtime·precision(i);
|
2010-07-20 06:53:16 -06:00
|
|
|
|
2010-10-25 18:55:50 -06:00
|
|
|
if (toarm) { // fix
|
2010-07-20 06:53:16 -06:00
|
|
|
f0 = m->freg[freg];
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·f64tointc(f0, &val, &ok);
|
2010-10-25 18:55:50 -06:00
|
|
|
if (!ok || (int32)val != val)
|
|
|
|
val = 0;
|
|
|
|
regs[reg] = val;
|
2010-07-20 06:53:16 -06:00
|
|
|
} else { // flt
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·fintto64c((int32)regs[reg], &f0);
|
2010-10-25 18:55:50 -06:00
|
|
|
m->freg[freg] = f0;
|
2010-07-20 06:53:16 -06:00
|
|
|
}
|
|
|
|
goto ret;
|
|
|
|
|
|
|
|
ret:
|
|
|
|
if (trace || doabort) {
|
|
|
|
if (toarm)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf(" %p %x\tfix%s\t\tr%d, f%d\n", pc, *pc, fpprec[prec], reg, freg);
|
2010-07-20 06:53:16 -06:00
|
|
|
else
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf(" %p %x\tflt%s\t\tf%d, r%d\n", pc, *pc, fpprec[prec], freg, reg);
|
|
|
|
runtime·fprint();
|
2010-07-20 06:53:16 -06:00
|
|
|
}
|
|
|
|
if (doabort)
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·fabort();
|
2010-07-20 06:53:16 -06:00
|
|
|
}
|
2010-04-15 03:43:49 -06:00
|
|
|
|
|
|
|
// returns number of words that the fp instruction is occupying, 0 if next instruction isn't float.
|
|
|
|
// TODO(kaib): insert sanity checks for coproc 1
|
|
|
|
static uint32
|
|
|
|
stepflt(uint32 *pc, uint32 *regs)
|
|
|
|
{
|
|
|
|
uint32 i, c;
|
2010-04-05 13:51:09 -06:00
|
|
|
|
2010-10-18 10:24:59 -06:00
|
|
|
//printf("stepflt %p %p\n", pc, *pc);
|
|
|
|
|
2009-12-17 17:08:42 -07:00
|
|
|
i = *pc;
|
2010-04-05 13:51:09 -06:00
|
|
|
|
2010-07-20 06:53:16 -06:00
|
|
|
// unconditional forward branches.
|
|
|
|
// inserted by linker after we instrument the code.
|
|
|
|
if ((i & 0xff000000) == 0xea000000) {
|
|
|
|
if (i & 0x00800000) {
|
|
|
|
return 0;
|
|
|
|
}
|
2010-07-28 06:58:35 -06:00
|
|
|
return (i & 0x007fffff) + 2;
|
2010-07-20 06:53:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
c = i >> 25 & 7;
|
2009-12-17 17:08:42 -07:00
|
|
|
switch(c) {
|
|
|
|
case 6: // 110
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·loadstore(pc, regs);
|
2010-04-05 13:51:09 -06:00
|
|
|
return 1;
|
2009-12-17 17:08:42 -07:00
|
|
|
case 7: // 111
|
2010-10-25 18:55:50 -06:00
|
|
|
if (i>>24 & 1)
|
|
|
|
return 0; // ignore swi
|
2010-04-15 03:43:49 -06:00
|
|
|
|
|
|
|
if (i>>4 & 1) { //data transfer
|
2010-07-20 06:53:16 -06:00
|
|
|
if ((i&0x00f0ff00) == 0x0090f100) {
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·compare(pc, regs);
|
2010-07-20 06:53:16 -06:00
|
|
|
} else if ((i&0x00e00f10) == 0x00000110) {
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·fltfix(pc, regs);
|
2010-07-20 06:53:16 -06:00
|
|
|
} else {
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·printf(" %p %x\t// case 7 fail\n", pc, i);
|
|
|
|
runtime·fabort();
|
2010-04-15 03:43:49 -06:00
|
|
|
}
|
|
|
|
} else {
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·dataprocess(pc);
|
2010-04-15 03:43:49 -06:00
|
|
|
}
|
2010-04-05 13:51:09 -06:00
|
|
|
return 1;
|
2009-12-17 17:08:42 -07:00
|
|
|
}
|
|
|
|
|
2010-10-18 11:24:19 -06:00
|
|
|
if((i&0xfffff000) == 0xe59fb000) {
|
|
|
|
// load r11 from pc-relative address.
|
|
|
|
// might be part of a floating point move
|
|
|
|
// (or might not, but no harm in simulating
|
|
|
|
// one instruction too many).
|
|
|
|
regs[11] = *(uint32*)((uint8*)pc + (i&0xfff) + 8);
|
|
|
|
return 1;
|
2009-12-17 17:08:42 -07:00
|
|
|
}
|
2010-10-25 18:55:50 -06:00
|
|
|
|
|
|
|
if(i == 0xe08bb00d) {
|
|
|
|
// add sp to 11.
|
|
|
|
// might be part of a large stack offset address
|
|
|
|
// (or might not, but again no harm done).
|
|
|
|
regs[11] += regs[13];
|
|
|
|
return 1;
|
|
|
|
}
|
2009-12-17 17:08:42 -07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma textflag 7
|
|
|
|
uint32*
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
runtime·_sfloat2(uint32 *lr, uint32 r0)
|
2009-12-17 17:08:42 -07:00
|
|
|
{
|
|
|
|
uint32 skip;
|
2010-04-05 13:51:09 -06:00
|
|
|
|
runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almost
Prefix all external symbols in runtime by runtime·,
to avoid conflicts with possible symbols of the same
name in linked-in C libraries. The obvious conflicts
are printf, malloc, and free, but hide everything to
avoid future pain.
The symbols left alone are:
** known to cgo **
_cgo_free
_cgo_malloc
libcgo_thread_start
initcgo
ncgocall
** known to linker **
_rt0_$GOARCH
_rt0_$GOARCH_$GOOS
text
etext
data
end
pclntab
epclntab
symtab
esymtab
** known to C compiler **
_divv
_modv
_div64by32
etc (arch specific)
Tested on darwin/386, darwin/amd64, linux/386, linux/amd64.
Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386.
R=r, PeterGo
CC=golang-dev
https://golang.org/cl/2899041
2010-11-04 12:00:19 -06:00
|
|
|
while(skip = runtime·stepflt(lr, &r0))
|
2009-12-17 17:08:42 -07:00
|
|
|
lr += skip;
|
|
|
|
return lr;
|
|
|
|
}
|
|
|
|
|