| 1 |
// Copyright 2009 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
package amd64 |
| 6 |
|
| 7 |
import ( |
| 8 |
"cmd/compile/internal/objw" |
| 9 |
"cmd/internal/obj" |
| 10 |
"cmd/internal/obj/x86" |
| 11 |
) |
| 12 |
|
| 13 |
func zerorange(pp *objw.Progs, p *obj.Prog, off, cnt int64, state *uint32) *obj.Prog { |
| 14 |
if cnt%8 != 0 { |
| 15 |
panic("zeroed region not aligned") |
| 16 |
} |
| 17 |
for cnt >= 16 { |
| 18 |
p = pp.Append(p, x86.AMOVUPS, obj.TYPE_REG, x86.REG_X15, 0, obj.TYPE_MEM, x86.REG_SP, off) |
| 19 |
off += 16 |
| 20 |
cnt -= 16 |
| 21 |
} |
| 22 |
if cnt != 0 { |
| 23 |
p = pp.Append(p, x86.AMOVQ, obj.TYPE_REG, x86.REG_X15, 0, obj.TYPE_MEM, x86.REG_SP, off) |
| 24 |
} |
| 25 |
return p |
| 26 |
} |
| 27 |
|
| 28 |
func ginsnop(pp *objw.Progs) *obj.Prog { |
| 29 |
// This is a hardware nop (1-byte 0x90) instruction, |
| 30 |
// even though we describe it as an explicit XCHGL here. |
| 31 |
// Particularly, this does not zero the high 32 bits |
| 32 |
// like typical *L opcodes. |
| 33 |
// (gas assembles "xchg %eax,%eax" to 0x87 0xc0, which |
| 34 |
// does zero the high 32 bits.) |
| 35 |
p := pp.Prog(x86.AXCHGL) |
| 36 |
p.From.Type = obj.TYPE_REG |
| 37 |
p.From.Reg = x86.REG_AX |
| 38 |
p.To.Type = obj.TYPE_REG |
| 39 |
p.To.Reg = x86.REG_AX |
| 40 |
return p |
| 41 |
} |