From d8004ff2dc60902bdee1eea0ccc4ffaa04dc1e45 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 17 Nov 2018 15:35:47 -0800 Subject: pkg/compiler: add vma64 type 8-byte vma is needed in several places in linux descriptions. --- docs/syscall_descriptions_syntax.md | 3 ++- pkg/compiler/testdata/all.txt | 7 +++++++ pkg/compiler/types.go | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/syscall_descriptions_syntax.md b/docs/syscall_descriptions_syntax.md index a3ac4f9c9..8ed95c261 100644 --- a/docs/syscall_descriptions_syntax.md +++ b/docs/syscall_descriptions_syntax.md @@ -52,8 +52,9 @@ rest of the type-options are type-specific: argname of the object "bitsize": similar to "len", but always denotes the size in bits, type-options: argname of the object -"vma": a pointer to a set of pages (used as input for mmap/munmap/mremap/madvise), type-options: +"vma"/"vma64": a pointer to a set of pages (used as input for mmap/munmap/mremap/madvise), type-options: optional number of pages (e.g. vma[7]), or a range of pages (e.g. vma[2-4]) + vma64 has size of 8 bytes regardless of target pointer size "proc": per process int (see description below), type-options: value range start, how many values per process, underlying type "text": machine code of the specified type, type-options: diff --git a/pkg/compiler/testdata/all.txt b/pkg/compiler/testdata/all.txt index 6fff34284..6863e5836 100644 --- a/pkg/compiler/testdata/all.txt +++ b/pkg/compiler/testdata/all.txt @@ -68,6 +68,13 @@ foo$len_templ(a ptr[in, len_templ1[int8, int16]]) foo$len_var0(a ptr[in, array[string]], b len[a]) foo$len_var1(a ptr[in, array[string]], b ptr[in, len[a, int32]]) +# Pointer type. + +foo$ptr(a ptr[in, int64]) +foo$ptr64(a ptr64[in, int64]) +foo$vma(a vma) +foo$vma64(a vma64) + # Void type. void0 { diff --git a/pkg/compiler/types.go b/pkg/compiler/types.go index 777920f57..98edc9d74 100644 --- a/pkg/compiler/types.go +++ b/pkg/compiler/types.go @@ -288,7 +288,7 @@ var typeFileoff = &typeDesc{ } var typeVMA = &typeDesc{ - Names: []string{"vma"}, + Names: []string{"vma", "vma64"}, CanBeArgRet: canBeArg, OptArgs: 1, Args: []namedArg{{Name: "size range", Type: typeArgSizeRange}}, @@ -298,6 +298,9 @@ var typeVMA = &typeDesc{ begin, end = args[0].Value, args[0].Value2 } base.TypeSize = comp.ptrSize + if t.Ident == "vma64" { + base.TypeSize = 8 + } return &prog.VmaType{ TypeCommon: base.TypeCommon, RangeBegin: begin, -- cgit mrf-deployment