Open akavel opened 8 years ago
Also, Syscall handling of unsafe.Pointer and uintptrs must be changed, per newly fleshed out rules regarding unsafe.Pointer->uintptr->syscall.Syscall handling.
Currently proposed solution would be to build a bitmask of the arguments list (with 1 on positions corresponding to unsafe.Pointer in args, 0 to other values), then switch into a machine-generated list of corresponding syscall.Syscall call combinations. That is, for example:
winq.F(int(1), byte(2), unsafe.Pointer(&x), unsafe.Pointer(&y)) // call site
// assuming: package winq; func F(args ...interface{}) (...)
tmpargs := []interface{}{}
// ...copy unsafe.Pointer args to tmpargs, others converted to uintptr...
bitmap = 0x03 // big endian binary: 0000 0011 -- or could use little endian instead
switch (nargs, bitmap) {
case (4, 0x03):
syscall.Syscall(tmpargs[0].(uintptr), tmpargs[1].(uintptr), uintptr(tmpargs[2].(unsafe.Pointer)), uintptr(tmpargs[3].(unsafe.Pointer)))
...
}
See:
https://github.com/golang/go/commit/6ab45c09f6fc1bde56e3a72e50505b9a5021aaaf
https://groups.google.com/forum/#!topic/golang-dev/AlMCfgQLkdo