Example #1
0
func DarwinInit(u models.Usercorn, args, env []string) error {
	if err := darwin.StackInit(u, args, env); err != nil {
		return err
	}
	// FIXME: lib43 crashes if 32-bit darwin gets mach header. maybe I need to align the stack.
	u.Pop()
	return nil
}
Example #2
0
func StackArgs(u models.Usercorn) func(n int) ([]uint64, error) {
	return func(n int) ([]uint64, error) {
		_, err := u.Pop()
		if err != nil {
			return nil, err
		}
		ret := make([]uint64, n)
		for i := 0; i < n; i++ {
			v, err := u.Pop()
			if err != nil {
				return nil, err
			}
			ret[i] = v
		}
		return ret, nil
	}
}