Skip to content

Commit

Permalink
fix x86_32 old_mmap syscall
Browse files Browse the repository at this point in the history
  • Loading branch information
lunixbochs committed Apr 23, 2018
1 parent e3f6c4d commit 40187a3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions go/arch/x86/linux.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package x86

import (
"fmt"
"github.com/lunixbochs/ghostrace/ghost/sys/num"
uc "github.com/unicorn-engine/unicorn/bindings/go/unicorn"

Expand Down Expand Up @@ -90,6 +91,22 @@ func (k *LinuxKernel) gdtWrite(sel, base, limit, access, flags uint32) error {
return s.Error
}

type mmapArgs struct {
Args []uint64 `struc:"[6]size_t"`
}

func (k *LinuxKernel) Mmap(buf co.Buf) uint64 {
var args mmapArgs
if err := buf.Unpack(&args); err != nil {
return posix.UINT64_MAX // FIXME
}
results, err := k.Argjoy.Call(k.PosixKernel.Mmap, args.Args)
if err != nil {
panic(fmt.Sprintf("LinuxKernel.Mmap(): %v", err))
}
return results[0].(uint64)
}

func (k *LinuxKernel) Socketcall(index int, params co.Buf) uint64 {
if name, ok := socketCallMap[index]; ok {
if sys := co.Lookup(k.U, k, name); sys != nil {
Expand Down

0 comments on commit 40187a3

Please sign in to comment.