VM_Address start = VM_Magic.objectAsAddress(buf).add(off);
  public static int writeBytes(int fd, byte buf[], int off, int cnt) {    if (off < 0)      throw new IndexOutOfBoundsException();    // trim request to fit array    // note: this behavior is the way the JDK does it (as of version 1.1.3)    // whereas the language spec says to throw IndexOutOfBounds exception...    //    if (off + cnt > buf.length)      cnt = buf.length - off;    // The canonical write loop.  Try the write repeatedly until    //   - it succeeds, or    //   - it returns an error    // If the write would have blocked, put this thread on the     // IO queue, then try again if it looks like the fd is ready.    VM_Address start = VM_Magic.objectAsAddress(buf).add(off);    if (!blockingWriteHack(fd))      return -2;    for (;;) {      int rc = VM_SysCall.sysWriteBytes(fd, start, cnt);      if (rc >= 0)	// Write succeeded	return rc;      else if (rc == -1) {	// Write would have blocked	VM_ThreadIOWaitData waitData = VM_Wait.ioWaitWrite(fd);	if (!isFdReady(waitData.writeFds[0]))	  // Fd is not ready, so presumably an error occurred while on IO queue	  return -2;	else	  // Fd apprears to be ready, so try write again	  continue;      }      else	// Write returned with an error	return -2;    }  }