From 11f2afa5a3c8cc88e10b001d6eb8790c8a3b91a7 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 2 Jun 2024 12:17:03 +0200 Subject: sys/targets: mark big-endian targets Litte-endian is kind of default (except for s390). So instead of saying that each arch is litte-endian, mark only s390 as big-endian. --- pkg/csource/csource.go | 4 ++-- pkg/report/linux.go | 12 +++--------- pkg/runtest/run.go | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) (limited to 'pkg') diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go index 1f338b893..198ddf7df 100644 --- a/pkg/csource/csource.go +++ b/pkg/csource/csource.go @@ -409,11 +409,11 @@ func (ctx *context) copyin(w *bytes.Buffer, csumSeq *int, copyin prog.ExecCopyin panic("bitfield+string format") } htobe := "" - if ctx.target.LittleEndian && arg.Format == prog.FormatBigEndian { + if !ctx.target.BigEndian && arg.Format == prog.FormatBigEndian { htobe = fmt.Sprintf("htobe%v", arg.Size*8) } bitfieldOffset := arg.BitfieldOffset - if !ctx.target.LittleEndian { + if ctx.target.BigEndian { bitfieldOffset = arg.Size*8 - arg.BitfieldOffset - arg.BitfieldLength } fmt.Fprintf(w, "\tNONFAILING(STORE_BY_BITMASK(uint%v, %v, 0x%x, %v, %v, %v));\n", diff --git a/pkg/report/linux.go b/pkg/report/linux.go index 50877e382..1dd5879cf 100644 --- a/pkg/report/linux.go +++ b/pkg/report/linux.go @@ -5,7 +5,6 @@ package report import ( "bytes" - "encoding/binary" "fmt" "path/filepath" "regexp" @@ -580,11 +579,6 @@ func (ctx *linux) decompileWithOffset(parsed parsedOpcodes) (*decompiledOpcodes, } func (ctx *linux) parseOpcodes(codeSlice string) (parsedOpcodes, error) { - binaryOps := binary.ByteOrder(binary.BigEndian) - if ctx.target.LittleEndian { - binaryOps = binary.LittleEndian - } - width := 0 bytes := []byte{} trapOffset := -1 @@ -620,11 +614,11 @@ func (ctx *linux) parseOpcodes(codeSlice string) (parsedOpcodes, error) { case 1: extraBytes[0] = byte(number) case 2: - binaryOps.PutUint16(extraBytes, uint16(number)) + ctx.target.HostEndian.PutUint16(extraBytes, uint16(number)) case 4: - binaryOps.PutUint32(extraBytes, uint32(number)) + ctx.target.HostEndian.PutUint32(extraBytes, uint32(number)) case 8: - binaryOps.PutUint64(extraBytes, number) + ctx.target.HostEndian.PutUint64(extraBytes, number) default: return parsedOpcodes{}, fmt.Errorf("invalid opcodes string: invalid width %v", width) } diff --git a/pkg/runtest/run.go b/pkg/runtest/run.go index 79d47d603..e0bf59816 100644 --- a/pkg/runtest/run.go +++ b/pkg/runtest/run.go @@ -232,7 +232,7 @@ nextSandbox: properties := map[string]bool{ "manual": ctx.Tests != "", // "manual" tests run only if selected by the filter explicitly. "sandbox=" + sandbox: true, - "littleendian": ctx.Target.LittleEndian, + "bigendian": sysTarget.BigEndian, } for _, threaded := range []bool{false, true} { name := name -- cgit mrf-deployment