1
0
mirror of https://github.com/golang/go synced 2024-11-19 23:44:43 -07:00
go/src/pkg/runtime/rt0_plan9_386.s
Akshat Kumar 7056ec6bfd runtime: fix floating point exception on Plan 9
Change 5660047 moved an FLDCW instruction
that disables invalid operand traps into
runtime·asminit, which is called from
runtime·mstart. Thus, runtime·check is being
called prior to setting the appropriate control bits,
which on any QNaN comparison will cause Plan 9
to take an invalid operand trap. This change loads
the control bits (for Plan 9) prior to runtime·check.
Ideally, this should be done before the QNaN checks
on any system, but possibly other kernels simply
don't ever trap on invalid operands.

R=golang-dev, rminnich
CC=golang-dev, john, rsc
https://golang.org/cl/5939045
2012-04-10 15:14:10 -04:00

34 lines
648 B
ArmAsm

// Copyright 2010 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.
TEXT _rt0_386_plan9(SB),7, $0
MOVL AX, _tos(SB)
// move arguments down to make room for
// m and g at top of stack, right before Tos.
MOVL SP, SI
SUBL $8, SP
MOVL SP, DI
MOVL AX, CX
SUBL SI, CX
CLD
REP; MOVSB
// adjust argv
SUBL SI, DI
MOVL newargc+0(SP), CX
LEAL newargv+4(SP), BP
argv_fix:
ADDL DI, 0(BP)
ADDL $4, BP
LOOP argv_fix
CALL runtime·asminit(SB)
JMP _rt0_386(SB)
DATA runtime·isplan9(SB)/4, $1
GLOBL runtime·isplan9(SB), $4
GLOBL _tos(SB), $4