MIPS: compat: Delete now unused TIF_32BIT.

Signed-off-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>

--- arch/mips/include/asm/thread_info.h
+++ arch/mips/include/asm/thread_info.h
@@ -112,12 +112,6 @@
 #define TIF_LOAD_WATCH		25	/* If set, load watch registers */
 #define TIF_SYSCALL_TRACE	31	/* syscall trace active */

-#ifdef CONFIG_MIPS32_O32
-#define TIF_32BIT TIF_32BIT_REGS
-#elif defined(CONFIG_MIPS32_N32)
-#define TIF_32BIT TIF_32BIT_ADDR
-#endif /* CONFIG_MIPS32_O32 */
-
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
 #define _TIF_SIGPENDING		(1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)


KVM: PPC: Book3S HV: Keep HPTE locked when invalidating

This reworks the implementations of the H_REMOVE and H_BULK_REMOVE
hcalls to make sure that we keep the HPTE locked and in the reverse-
mapping chain until we have finished invalidating it.  Previously
we would remove it from the chain and unlock it before invalidating
it, leaving a tiny window when the guest could access the page even
though we believe we have removed it from the guest (e.g.,
kvm_unmap_hva() has been called for the page and has found no HPTEs
in the chain).  In addition, we'll need this for future patches where
we will need to read the R and C bits in the HPTE after invalidating
it.

Doing this required restructuring kvmppc_h_bulk_remove() substantially.
Since we want to batch up the tlbies, we now need to keep several
HPTEs locked simultaneously.  In order to avoid possible deadlocks,
we don't spin on the HPTE bitlock for any except the first HPTE in
a batch.  If we can't acquire the HPTE bitlock for the second or
subsequent HPTE, we terminate the batch at that point, do the tlbies
that we have accumulated so far, unlock those HPTEs, and then start
a new batch to do the remaining invalidations.

Signed-off-by: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>
Signed-off-by: Alexander Graf <3ad82b0c937b9aa51276120cedd545efc822be04@suse.de>
Signed-off-by: Avi Kivity <8f920f22884d6fea9df883843c4a8095a2e5ac6f@redhat.com>

--- arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -138,6 +138,12 @@
 	if (!pte_present(*ptep))
 		return __pte(0);
 	return kvmppc_read_update_linux_pte(ptep, writing);
+}
+
+static inline void unlock_hpte(unsigned long *hpte, unsigned long hpte_v)
+{
+	asm volatile(PPC_RELEASE_BARRIER "" : : : "memory");
+	hpte[0] = hpte_v;
 }

 long kvmppc_h_enter(struct kvm_vcpu *vcpu, unsigned long flags,
@@ -356,6 +362,7 @@
 	struct kvm *kvm = vcpu->kvm;
 	unsigned long *hpte;
 	unsigned long v, r, rb;
+	struct revmap_entry *rev;

 	if (pte_index >= HPT_NPTE)
 		return H_PARAMETER;
@@ -368,30 +375,32 @@
 		hpte[0] &= ~HPTE_V_HVLOCK;
 		return H_NOT_FOUND;
 	}
-	if (atomic_read(&kvm->online_vcpus) == 1)
-		flags |= H_LOCAL;
-	vcpu->arch.gpr[4] = v = hpte[0] & ~HPTE_V_HVLOCK;
-	vcpu->arch.gpr[5] = r = hpte[1];
-	rb = compute_tlbie_rb(v, r, pte_index);
-	if (v & HPTE_V_VALID)
+
+	rev = real_vmalloc_addr(&kvm->arch.revmap[pte_index]);
+	v = hpte[0] & ~HPTE_V_HVLOCK;
+	if (v & HPTE_V_VALID) {
+		hpte[0] &= ~HPTE_V_VALID;
+		rb = compute_tlbie_rb(v, hpte[1], pte_index);
+		if (!(flags & H_LOCAL) && atomic_read(&kvm->online_vcpus) > 1) {
+			while (!try_lock_tlbie(&kvm->arch.tlbie_lock))
+				cpu_relax();
+			asm volatile("ptesync" : : : "memory");
+			asm volatile(PPC_TLBIE(%1,%0)"; eieio; tlbsync"
+				     : : "r" (rb), "r" (kvm->arch.lpid));
+			asm volatile("ptesync" : : : "memory");
+			kvm->arch.tlbie_lock = 0;
+		} else {
+			asm volatile("ptesync" : : : "memory");
+			asm volatile("tlbiel %0" : : "r" (rb));
+			asm volatile("ptesync" : : : "memory");
+		}
 		remove_revmap_chain(kvm, pte_index, v);
-	smp_wmb();
-	hpte[0] = 0;
-	if (!(v & HPTE_V_VALID))
-		return H_SUCCESS;
-	if (!(flags & H_LOCAL)) {
-		while (!try_lock_tlbie(&kvm->arch.tlbie_lock))
-			cpu_relax();
-		asm volatile("ptesync" : : : "memory");
-		asm volatile(PPC_TLBIE(%1,%0)"; eieio; tlbsync"
-			     : : "r" (rb), "r" (kvm->arch.lpid));
-		asm volatile("ptesync" : : : "memory");
-		kvm->arch.tlbie_lock = 0;
-	} else {
-		asm volatile("ptesync" : : : "memory");
-		asm volatile("tlbiel %0" : : "r" (rb));
-		asm volatile("ptesync" : : : "memory");
-	}
+	}
+	r = rev->guest_rpte;
+	unlock_hpte(hpte, 0);
+
+	vcpu->arch.gpr[4] = v;
+	vcpu->arch.gpr[5] = r;
 	return H_SUCCESS;
 }

@@ -399,82 +408,113 @@
 {
 	struct kvm *kvm = vcpu->kvm;
 	unsigned long *args = &vcpu->arch.gpr[4];
-	unsigned long *hp, tlbrb[4];
-	long int i, found;
-	long int n_inval = 0;
-	unsigned long flags, req, pte_index;
+	unsigned long *hp, *hptes[4], tlbrb[4];
+	long int i, j, k, n, found, indexes[4];
+	unsigned long flags, req, pte_index, rcbits;
 	long int local = 0;
 	long int ret = H_SUCCESS;
+	struct revmap_entry *rev, *revs[4];

 	if (atomic_read(&kvm->online_vcpus) == 1)
 		local = 1;
-	for (i = 0; i < 4; ++i) {
-		pte_index = args[i * 2];
-		flags = pte_index >> 56;
-		pte_index &= ((1ul << 56) - 1);
-		req = flags >> 6;
-		flags &= 3;
-		if (req == 3)
-			break;
-		if (req != 1 || flags == 3 ||
-		    pte_index >= HPT_NPTE) {
-			/* parameter error */
-			args[i * 2] = ((0xa0 | flags) << 56) + pte_index;
-			ret = H_PARAMETER;
-			break;
-		}
-		hp = (unsigned long *)(kvm->arch.hpt_virt + (pte_index << 4));
-		while (!try_lock_hpte(hp, HPTE_V_HVLOCK))
-			cpu_relax();
-		found = 0;
-		if (hp[0] & (HPTE_V_ABSENT | HPTE_V_VALID)) {
-			switch (flags & 3) {
-			case 0:		/* absolute */
-				found = 1;
-				break;
-			case 1:		/* andcond */
-				if (!(hp[0] & args[i * 2 + 1]))
-					found = 1;
-				break;
-			case 2:		/* AVPN */
-				if ((hp[0] & ~0x7fUL) == args[i * 2 + 1])
-					found = 1;
+	for (i = 0; i < 4 && ret == H_SUCCESS; ) {
+		n = 0;
+		for (; i < 4; ++i) {
+			j = i * 2;
+			pte_index = args[j];
+			flags = pte_index >> 56;
+			pte_index &= ((1ul << 56) - 1);
+			req = flags >> 6;
+			flags &= 3;
+			if (req == 3) {		/* no more requests */
+				i = 4;
 				break;
 			}
-		}
-		if (!found) {
-			hp[0] &= ~HPTE_V_HVLOCK;
-			args[i * 2] = ((0x90 | flags) << 56) + pte_index;
-			continue;
-		}
-		/* insert R and C bits from PTE */
-		flags |= (hp[1] >> 5) & 0x0c;
-		args[i * 2] = ((0x80 | flags) << 56) + pte_index;
-		if (hp[0] & HPTE_V_VALID) {
-			tlbrb[n_inval++] = compute_tlbie_rb(hp[0], hp[1], pte_index);
+			if (req != 1 || flags == 3 || pte_index >= HPT_NPTE) {
+				/* parameter error */
+				args[j] = ((0xa0 | flags) << 56) + pte_index;
+				ret = H_PARAMETER;
+				break;
+			}
+			hp = (unsigned long *)
+				(kvm->arch.hpt_virt + (pte_index << 4));
+			/* to avoid deadlock, don't spin except for first */
+			if (!try_lock_hpte(hp, HPTE_V_HVLOCK)) {
+				if (n)
+					break;
+				while (!try_lock_hpte(hp, HPTE_V_HVLOCK))
+					cpu_relax();
+			}
+			found = 0;
+			if (hp[0] & (HPTE_V_ABSENT | HPTE_V_VALID)) {
+				switch (flags & 3) {
+				case 0:		/* absolute */
+					found = 1;
+					break;
+				case 1:		/* andcond */
+					if (!(hp[0] & args[j + 1]))
+						found = 1;
+					break;
+				case 2:		/* AVPN */
+					if ((hp[0] & ~0x7fUL) == args[j + 1])
+						found = 1;
+					break;
+				}
+			}
+			if (!found) {
+				hp[0] &= ~HPTE_V_HVLOCK;
+				args[j] = ((0x90 | flags) << 56) + pte_index;
+				continue;
+			}
+
+			args[j] = ((0x80 | flags) << 56) + pte_index;
+			rev = real_vmalloc_addr(&kvm->arch.revmap[pte_index]);
+			/* insert R and C bits from guest PTE */
+			rcbits = rev->guest_rpte & (HPTE_R_R|HPTE_R_C);
+			args[j] |= rcbits << (56 - 5);
+
+			if (!(hp[0] & HPTE_V_VALID))
+				continue;
+
+			hp[0] &= ~HPTE_V_VALID;		/* leave it locked */
+			tlbrb[n] = compute_tlbie_rb(hp[0], hp[1], pte_index);
+			indexes[n] = j;
+			hptes[n] = hp;
+			revs[n] = rev;
+			++n;
+		}
+
+		if (!n)
+			break;
+
+		/* Now that we've collected a batch, do the tlbies */
+		if (!local) {
+			while(!try_lock_tlbie(&kvm->arch.tlbie_lock))
+				cpu_relax();
+			asm volatile("ptesync" : : : "memory");
+			for (k = 0; k < n; ++k)
+				asm volatile(PPC_TLBIE(%1,%0) : :
+					     "r" (tlbrb[k]),
+					     "r" (kvm->arch.lpid));
+			asm volatile("eieio; tlbsync; ptesync" : : : "memory");
+			kvm->arch.tlbie_lock = 0;
+		} else {
+			asm volatile("ptesync" : : : "memory");
+			for (k = 0; k < n; ++k)
+				asm volatile("tlbiel %0" : : "r" (tlbrb[k]));
+			asm volatile("ptesync" : : : "memory");
+		}
+
+		for (k = 0; k < n; ++k) {
+			j = indexes[k];
+			pte_index = args[j] & ((1ul << 56) - 1);
+			hp = hptes[k];
+			rev = revs[k];
 			remove_revmap_chain(kvm, pte_index, hp[0]);
-		}
-		smp_wmb();
-		hp[0] = 0;
-	}
-	if (n_inval == 0)
-		return ret;
-
-	if (!local) {
-		while(!try_lock_tlbie(&kvm->arch.tlbie_lock))
-			cpu_relax();
-		asm volatile("ptesync" : : : "memory");
-		for (i = 0; i < n_inval; ++i)
-			asm volatile(PPC_TLBIE(%1,%0)
-				     : : "r" (tlbrb[i]), "r" (kvm->arch.lpid));
-		asm volatile("eieio; tlbsync; ptesync" : : : "memory");
-		kvm->arch.tlbie_lock = 0;
-	} else {
-		asm volatile("ptesync" : : : "memory");
-		for (i = 0; i < n_inval; ++i)
-			asm volatile("tlbiel %0" : : "r" (tlbrb[i]));
-		asm volatile("ptesync" : : : "memory");
-	}
+			unlock_hpte(hp, 0);
+		}
+	}
+
 	return ret;
 }

@@ -720,9 +760,7 @@
 	rev = real_vmalloc_addr(&kvm->arch.revmap[index]);
 	gr = rev->guest_rpte;

-	/* Unlock the HPTE */
-	asm volatile("lwsync" : : : "memory");
-	hpte[0] = v;
+	unlock_hpte(hpte, v);

 	/* For not found, if the HPTE is valid by now, retry the instruction */
 	if ((status & DSISR_NOHPTE) && (v & HPTE_V_VALID))


crypto: twofish-x86_64-3way - blacklist pentium4 and atom

Performance of twofish-x86_64-3way on Intel Pentium 4 and Atom is lower than
of twofish-x86_64 module. So blacklist these CPUs.

Signed-off-by: Jussi Kivilinna <1f0aa498f7c1bee2bd6061b97aca51d7b122cec0@mbnet.fi>
Signed-off-by: Herbert Xu <ef65de1c7be0aa837fe7b25ba9a7739905af6a55@gondor.apana.org.au>


McdAccountManager: officially support setting RequestedPresence at creation

--- src/mcd-account-manager.c
+++ src/mcd-account-manager.c
@@ -708,12 +708,11 @@
         TP_IFACE_ACCOUNT ".Icon",
         TP_IFACE_ACCOUNT ".Nickname",
         TP_IFACE_ACCOUNT ".ConnectAutomatically",
+        TP_IFACE_ACCOUNT ".RequestedPresence",
         TP_IFACE_ACCOUNT_INTERFACE_AVATAR ".Avatar",
         MC_IFACE_ACCOUNT_INTERFACE_COMPAT ".Profile",
         MC_IFACE_ACCOUNT_INTERFACE_COMPAT ".SecondaryVCardFields",
         MC_IFACE_ACCOUNT_INTERFACE_CONDITIONS ".Condition",
-        /* FIXME: setting RequestedPresence at create time doesn't work yet */
-        /* TP_IFACE_ACCOUNT ".RequestedPresence", */
         NULL
     };


Bluetooth: L2CAP: Only set state for dynamic channels

Fixed channels don't really use channels state as they don't need
connection setup.

Change-Id: Ie8b1327db0269a45e9ccb6049f8dda87aa445fb5
Signed-off-by: Luiz Augusto von Dentz <8530c5ea66a1bdbc08f98bfcf183c8be901b5990@intel.com>

--- subsys/bluetooth/host/l2cap.c
+++ subsys/bluetooth/host/l2cap.c
@@ -316,7 +316,8 @@

 	bt_l2cap_chan_add(conn, chan, destroy);

-	if (IS_ENABLED(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL)) {
+	if (IS_ENABLED(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL) &&
+	    L2CAP_LE_CID_IS_DYN(ch->rx.cid)) {
 		bt_l2cap_chan_set_state(chan, BT_L2CAP_CONNECT);
 	}


On the 'inheritable-props' branch: Fix the fallback logic for
svn_ra_get_inherited_props() to also ignore SVN_ERR_RA_DAV_FORBIDDEN
errors.  (Why, again, do we have to have two different error code to
mean, "No, you can't see that"?)

This fixes 'auth_tests.py 16' and 'iprop_authz_tests.py 1' when run
against a trunk (non-iprop-capable) server.

* subversion/libsvn_ra/compat.c
  (svn_ra__get_inherited_props_walk): Also ignore SVN_ERR_RA_DAV_FORBIDDEN.

git-svn-id: ae8f6d14bbdc7ff690355f143f05114066724748@1384899 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_ra/compat.c
+++ subversion/libsvn_ra/compat.c
@@ -919,7 +919,8 @@
          skip, but allow them to inherit from further up. */
       if (err)
         {
-          if (err->apr_err == SVN_ERR_RA_NOT_AUTHORIZED)
+          if ((err->apr_err == SVN_ERR_RA_NOT_AUTHORIZED)
+              || (err->apr_err == SVN_ERR_RA_DAV_FORBIDDEN))
             {
               svn_error_clear(err);
               continue;


Fix crash with "svn lock" against the (currently 1.1.1) tigris.org server
which uses a home-grown mod_auth_svn (no, not a typo!).

* subversion/libsvn_subr/auth.c (svn_auth_save_credentials): Don't
  save credentials if the iteration state's provider index is out
  of bounds.

Patch by: Philip Martin <philip@codematters.co.uk>

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@855777 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_subr/auth.c
+++ subversion/libsvn_subr/auth.c
@@ -297,7 +297,7 @@
   svn_auth_baton_t *auth_baton;
   void *creds;

-  if (! state)
+  if (! state || state->table->providers->nelts <= state->provider_idx)
     return SVN_NO_ERROR;

   auth_baton = state->auth_baton;


A follow-up to r22457 tweaking some code style.

* subversion/libsvn_subr/path.c
  (svn_path_is_root): Compact a boolean return block, and correct
   indentation on closing curly brace.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@862554 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_subr/path.c
+++ subversion/libsvn_subr/path.c
@@ -470,11 +470,8 @@
                 return FALSE;
             }
         }
-      if (segments <= 1)
-        return TRUE;
-      else
-        return FALSE;
-     }
+      return (segments <= 1);
+    }
 #endif /* WIN32 or Cygwin */

   return FALSE;


* subversion/libsvn_wc/status.c (get_dir_status): Don't explicitly add a   subdirectory status structure if we are about to descend into it.

--- subversion/libsvn_wc/status.c
+++ subversion/libsvn_wc/status.c
@@ -619,14 +619,8 @@
                 SVN_ERR (svn_wc_entry (&fullpath_entry, fullpath,
                                        adm_access, FALSE, pool));

-              SVN_ERR (add_status_structure
-                       (statushash, fullpath, adm_access, fullpath_entry,
-                        dir_entry, fullpath_kind, get_all, FALSE,
-                        notify_func, notify_baton, pool));
-
               /* Descend only if the subdirectory is a working copy
                  directory (and DESCEND is non-zero ofcourse)  */
-
               if (descend && fullpath_entry != entry)
                 {
                   svn_wc_adm_access_t *dir_access;
@@ -638,6 +632,12 @@
                                            notify_baton, cancel_func,
                                            cancel_baton, pool));
                 }
+              else
+                SVN_ERR (add_status_structure
+                         (statushash, fullpath, adm_access, fullpath_entry,
+                          dir_entry, fullpath_kind, get_all, FALSE,
+                          notify_func, notify_baton, pool));
+
             }
           else
             {


Revert the removal of the calculations of repository paths of remotely added
nodes in r953751, by reintroducing similar code using repository relative paths.

This should fix the javahl test failure recently introduced by markphip.

* subversion/libsvn_wc/status.c
  (dir_baton, file_baton): Add repos_relpath field.
  (tweak_statushash): Fill repos_relpath from baton if not already read from
    the working copy.
  (make_dir_baton, make_file_baton): Calculate and store repos_relpath.

Found by: markphip
          philip

--- subversion/libsvn_wc/status.c
+++ subversion/libsvn_wc/status.c
@@ -186,6 +186,9 @@
   /* The pool in which this baton itself is allocated. */
   apr_pool_t *pool;

+  /* The repository root relative path to this item in the repository. */
+  const char *repos_relpath;
+
   /* out-of-date info corresponding to ood_* fields in svn_wc_status3_t. */
   svn_node_kind_t ood_kind;
   svn_revnum_t ood_changed_rev;
@@ -224,6 +227,9 @@
   /* This gets set if the file underwent a prop change, which guides
      the code that syncs up the adm dir and working copy. */
   svn_boolean_t prop_changed;
+
+  /* The repository root relative path to this item in the repository. */
+  const char *repos_relpath;

   /* out-of-date info corresponding to ood_* fields in svn_wc_status3_t. */
   svn_node_kind_t ood_kind;
@@ -1576,6 +1582,27 @@
     {
       struct dir_baton *b = this_dir_baton;

+      if (!statstruct->repos_relpath && b->repos_relpath)
+        {
+          if (statstruct->repos_node_status == svn_wc_status_deleted)
+            {
+              /* When deleting PATH, BATON is for PATH's parent,
+                 so we must construct PATH's real statstruct->url. */
+              statstruct->repos_relpath =
+                            svn_relpath_join(b->repos_relpath,
+                                             svn_dirent_basename(local_abspath,
+                                                                 NULL),
+                                             pool);
+            }
+          else
+            statstruct->repos_relpath = apr_pstrdup(pool, b->repos_relpath);
+
+          statstruct->repos_root_url =
+                              b->edit_baton->anchor_status->repos_root_url;
+          statstruct->repos_uuid =
+                              b->edit_baton->anchor_status->repos_uuid;
+        }
+
       /* The last committed date, and author for deleted items
          isn't available. */
       if (statstruct->repos_node_status == svn_wc_status_deleted)
@@ -1609,6 +1636,14 @@
       struct file_baton *b = baton;
       statstruct->ood_changed_rev = b->ood_changed_rev;
       statstruct->ood_changed_date = b->ood_changed_date;
+      if (!statstruct->repos_relpath && b->repos_relpath)
+        {
+          statstruct->repos_relpath = apr_pstrdup(pool, b->repos_relpath);
+          statstruct->repos_root_url =
+                          b->edit_baton->anchor_status->repos_root_url;
+          statstruct->repos_uuid =
+                          b->edit_baton->anchor_status->repos_uuid;
+        }
       statstruct->ood_kind = b->ood_kind;
       if (b->ood_changed_author)
         statstruct->ood_changed_author =
@@ -1631,9 +1666,9 @@
       const svn_wc_status3_t *status = apr_hash_get(pb->statii,
                                                     db->local_abspath,
                                                     APR_HASH_KEY_STRING);
-      /* Note that status->url is NULL in the case of a missing
-       * directory, which means we need to recurse up another level to
-       * get a useful URL. */
+      /* Note that status->repos_relpath could be NULL in the case of a missing
+       * directory, which means we need to recurse up another level to get
+       * a useful relpath. */
       if (status)
         return status->repos_relpath;

@@ -1679,6 +1714,7 @@
   d->statii = apr_hash_make(pool);
   d->ood_changed_rev = SVN_INVALID_REVNUM;
   d->ood_changed_date = 0;
+  d->repos_relpath = apr_pstrdup(pool, find_dir_repos_relpath(d, pool));
   d->ood_kind = svn_node_dir;
   d->ood_changed_author = NULL;

@@ -1772,6 +1808,8 @@
   f->edit_baton = eb;
   f->ood_changed_rev = SVN_INVALID_REVNUM;
   f->ood_changed_date = 0;
+  f->repos_relpath = svn_relpath_join(find_dir_repos_relpath(pb, pool),
+                                      f->name, pool);
   f->ood_kind = svn_node_file;
   f->ood_changed_author = NULL;
   return f;


[Truffle] Pass rb_str_new specs.

[Truffle] Pass rb_str_new specs.

* String.new(java_string) should return a binary string.

--- optional/capi/ext/jruby_truffle.h
+++ optional/capi/ext/jruby_truffle.h
@@ -175,7 +175,6 @@
 #undef HAVE_RB_OBJ_ENCODING

 #undef HAVE_RB_STR_ENCODE
-#undef HAVE_RB_STR_NEW_CSTR
 #undef HAVE_RB_USASCII_STR_NEW
 #undef HAVE_RB_USASCII_STR_NEW_CSTR
 #undef HAVE_RB_EXTERNAL_STR_NEW
@@ -409,8 +408,6 @@
 #undef HAVE_RB_STR_UPDATE
 #undef HAVE_RB_STR_INSPECT
 #undef HAVE_RB_STR_INTERN
-#undef HAVE_RB_STR_NEW
-#undef HAVE_RB_STR_NEW2
 #undef HAVE_RB_STR_NEW3
 #undef HAVE_RB_STR_NEW4
 #undef HAVE_RB_STR_NEW5


* subversion/mod_dav_svn/util.c: Tweak comment on top of file. I just *had* to
   put this somewhere, if only to make people go find out where it's from.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@1612256 13f79535-47bb-0310-9956-ffa450edef68


EKF: capture full quaternion change for reset events

--- EKF/ekf.h
+++ EKF/ekf.h
@@ -152,12 +152,12 @@
 		uint64_t velD_time_us;	// time stamp of the last vertical velocity reset event (us)
 		uint64_t posNE_time_us; // time stamp of the last horizontal position reset event (us)
 		uint64_t posD_time_us;	// time stamp of the last vertical position reset event (us)
-		uint64_t yaw_time_us;   // time stamp of the last yaw angle reset event (us)
+		uint64_t quat_time_us;  // time stamp of the last quaternion reset event (us)
 		Vector2f velNE_change;  // North East velocity change due to last reset (m)
 		float velD_change;	// Down velocity change due to last reset (m/s)
 		Vector2f posNE_change;	// North, East position change due to last reset (m)
 		float posD_change;	// Down position change due to last reset (m)
-		float yaw_change;	// Yaw angle change due to last reset (rad)
+		Quaternion quat_change;	// quaternion delta due to last reset - multiply pre-reset quaternion by this to get post-reset quaternion
 	} _state_reset_status;

 	float _dt_ekf_avg;		// average update rate of the ekf


gibber-xmpp-stanza.c: use type_names array to find the optionnal NS associated with a type

20070612163754-7fe3f-a3af4d83860cdfabecfcad53976adf601434aa4b.gz

--- lib/gibber/gibber-xmpp-stanza.c
+++ lib/gibber/gibber-xmpp-stanza.c
@@ -41,22 +41,23 @@
 {
     GibberStanzaType type;
     const gchar *name;
+    const gchar *ns;
 } StanzaTypeName;

 static const StanzaTypeName type_names[LAST_GIBBER_STANZA_TYPE] =
 {
-    { GIBBER_STANZA_TYPE_NONE,               NULL },
-    { GIBBER_STANZA_TYPE_MESSAGE,            "message" },
-    { GIBBER_STANZA_TYPE_PRESENCE,           "presence" },
-    { GIBBER_STANZA_TYPE_IQ,                 "iq" },
-    { GIBBER_STANZA_TYPE_STREAM,             "stream" },
-    { GIBBER_STANZA_TYPE_STREAM_FEATURES,    "features" },
-    { GIBBER_STANZA_TYPE_AUTH,               "auth" },
-    { GIBBER_STANZA_TYPE_CHALLENGE,          "challenge" },
-    { GIBBER_STANZA_TYPE_RESPONSE,           "response" },
-    { GIBBER_STANZA_TYPE_SUCCESS,            "success" },
-    { GIBBER_STANZA_TYPE_FAILURE,            "failure" },
-    { GIBBER_STANZA_TYPE_STREAM_ERROR,       "error" },
+    { GIBBER_STANZA_TYPE_NONE,            NULL,        NULL },
+    { GIBBER_STANZA_TYPE_MESSAGE,         "message",   NULL },
+    { GIBBER_STANZA_TYPE_PRESENCE,        "presence",  NULL },
+    { GIBBER_STANZA_TYPE_IQ,              "iq",        NULL },
+    { GIBBER_STANZA_TYPE_STREAM,          "stream",    GIBBER_XMPP_NS_STREAM },
+    { GIBBER_STANZA_TYPE_STREAM_FEATURES, "features",  GIBBER_XMPP_NS_STREAM },
+    { GIBBER_STANZA_TYPE_AUTH,            "auth",      NULL },
+    { GIBBER_STANZA_TYPE_CHALLENGE,       "challenge", NULL },
+    { GIBBER_STANZA_TYPE_RESPONSE,        "response",  NULL },
+    { GIBBER_STANZA_TYPE_SUCCESS,         "success",   NULL },
+    { GIBBER_STANZA_TYPE_FAILURE,         "failure",   NULL },
+    { GIBBER_STANZA_TYPE_STREAM_ERROR,    "error",     GIBBER_XMPP_NS_STREAM },
 };

 typedef struct
@@ -245,6 +246,17 @@
 }

 static const gchar *
+get_type_ns (GibberStanzaType type)
+{
+  if (type < GIBBER_STANZA_TYPE_NONE ||
+      type >= LAST_GIBBER_STANZA_TYPE)
+    return NULL;
+
+  g_assert (type_names[type].type == type);
+  return type_names[type].ns;
+}
+
+static const gchar *
 get_sub_type_name (GibberStanzaSubType sub_type)
 {
   if (sub_type < GIBBER_STANZA_SUB_TYPE_NONE ||
@@ -283,11 +295,7 @@
     return NULL;

   stanza = gibber_xmpp_stanza_new (get_type_name (type));
-
-  if (type == GIBBER_STANZA_TYPE_STREAM_FEATURES ||
-      type == GIBBER_STANZA_TYPE_STREAM ||
-      type == GIBBER_STANZA_TYPE_STREAM_ERROR)
-    gibber_xmpp_node_set_ns (stanza->node, GIBBER_XMPP_NS_STREAM);
+  gibber_xmpp_node_set_ns (stanza->node, get_type_ns (type));

   sub_type_name = get_sub_type_name (sub_type);
   if (sub_type_name != NULL)


added utf-8 to lowercase code using sed

added utf-8 to lowercase code using sed

--- tests/test-registrable-domain.c
+++ tests/test-registrable-domain.c
@@ -48,7 +48,34 @@

 static void test(const psl_ctx_t *psl, const char *domain, const char *expected_result)
 {
-	const char *result = psl_registrable_domain(psl, domain);
+	const char *result;
+	char lookupname[128];
+
+	// check if there might be some utf-8 characters
+	if (domain) {
+		int utf8;
+		const char *p;
+
+		for (p = domain, utf8 = 0; *p && !utf8; p++)
+			if (*p < 0)
+				utf8 = 1;
+
+		// if we found utf-8, make sure to convert domain correctly to lowercase
+		// does it work, if we are not in a utf-8 env ?
+		if (utf8) {
+			FILE *pp;
+			char cmd[48 + strlen(domain)];
+
+			snprintf(cmd, sizeof(cmd), "echo -n '%s' | sed -e 's/./\\L\\0/g'", domain);
+			if ((pp = popen(cmd, "r"))) {
+				if (fscanf(pp, "%127s", lookupname) >= 1)
+					domain = lookupname;
+				pclose(pp);
+			}
+		}
+	}
+
+	result = psl_registrable_domain(psl, domain);

 	if ((result && expected_result && !strcmp(result, expected_result)) || (!result && !expected_result)) {
 		ok++;
@@ -79,7 +106,7 @@
 	test(NULL, "com", NULL);

 	// Norwegian with uppercase oe
-	// test(psl, "www.\303\230yer.no", "www.\303\270yer.no");
+	test(psl, "www.\303\230yer.no", "www.\303\270yer.no");

 	// Norwegian with lowercase oe
 	test(psl, "www.\303\270yer.no", "www.\303\270yer.no");
@@ -93,7 +120,7 @@

 			// we have to lowercase the domain - the PSL API just takes lowercase
 			for (p = domain; *p; p++)
-				if (isupper(*p))
+				if (*p > 0 && isupper(*p))
 					*p = tolower(*p);

 			// there are test cases with 'example' unlisted TLD, unsure how to handle these, so skip for the moment


tests: Drop unused variable

tests: Drop unused variable

Closes: #1857
Approved by: cgwalters

--- tests/test-repo-finder-config.c
+++ tests/test-repo-finder-config.c
@@ -308,7 +308,6 @@
 test_repo_finder_config_find_remotes (Fixture       *fixture,
                                       gconstpointer  test_data)
 {
-  g_autoptr(OstreeRepoFinder) finder = NULL;
   g_autoptr(GMainContext) context = NULL;
   g_autoptr(GAsyncResult) result = NULL;
   g_auto(OstreeRepoFinderResultv) results = NULL;


No need to check type if we only register to one event.

--- src/modules/conf/e_conf.c
+++ src/modules/conf/e_conf.c
@@ -510,7 +510,6 @@
    E_Configure *eco;
    int sel = 0;

-   if (type != E_EVENT_MODULE_UPDATE) return 1;
    eco = data;
    if (!eco) return 1;
    sel = e_widget_ilist_selected_get(eco->cat_list);


Fixed calculating W ratio

Fixed calculating W ratio

--- src/moves/MultiParticle.h
+++ src/moves/MultiParticle.h
@@ -12,7 +12,7 @@
 #include "StaticVals.h"
 #include <cmath>

-#define MIN_FORCE 1E-6
+#define MIN_FORCE 1E-12
 #define MAX_FORCE 30

 class MultiParticle : public MoveBase
@@ -218,34 +218,29 @@
                                                 double max, double sign)
 {
   double w_ratio = 1.0;
-
-  if(abs(lb.x) < MIN_FORCE) {
+  XYZ lbmax = lb * max;
+
+  if(abs(lbmax.x) > MIN_FORCE && abs(lbmax.x) < MAX_FORCE) {
+    w_ratio *= lb.x * exp(lb.x * sign * k.x) / (2.0*sinh(lb.x * max));
+  }  else {
     w_ratio *= 1.0 / (2.0 * max);
-  } else if (abs(lb.x) > MAX_FORCE) {
-    w_ratio *= 0.0;
-  }
-  else {
-    w_ratio *= lb.x * exp(lb.x * sign * k.x) / (2.0*sinh(lb.x * max));
-  }
-
-  if(abs(lb.y) < MIN_FORCE) {
+  }
+
+  if(abs(lbmax.y) > MIN_FORCE && abs(lbmax.y) < MAX_FORCE){
+    w_ratio *= lb.y * exp(lb.y * sign * k.y) / (2.0*sinh(lb.y * max));
+  } else {
     w_ratio *= 1.0 / (2.0 * max);
-  } else if (abs(lb.y) > MAX_FORCE) {
-    w_ratio *= 0.0;
-  }
-  else {
-    w_ratio *= lb.y * exp(lb.y * sign * k.y) / (2.0*sinh(lb.y * max));
-  }
-
-  if(abs(lb.z) < MIN_FORCE) {
+  }
+
+  if(abs(lbmax.z) > MIN_FORCE && abs(lbmax.z) < MAX_FORCE){
+    w_ratio *= lb.z * exp(lb.z * sign * k.z) / (2.0*sinh(lb.z * max));
+  } else {
     w_ratio *= 1.0 / (2.0 * max);
-  } else if (abs(lb.z) > MAX_FORCE) {
-    w_ratio *= 0.0;
-  }
-  else {
-    w_ratio *= lb.z * exp(lb.z * sign * k.z) / (2.0*sinh(lb.z * max));
-  }
-
+  }
+
+  // if(sign == -1) {
+  //   cout << "w_ratio: " << w_ratio << endl;
+  // }
   return w_ratio;
 }

@@ -300,6 +295,8 @@
   long double MPCoeff = GetCoeff();
   double uBoltz = exp(-BETA * (sysPotNew.Total() - sysPotRef.Total()));
   long double accept = MPCoeff * uBoltz;
+  // cout << "MPCoeff: " << MPCoeff << ", sysPotNew: " << sysPotNew.Total()
+  //      << ", sysPotRef: " << sysPotRef.Total() << ", accept: " << accept <<endl;
   bool result = (rejectState == mv::fail_state::NO_FAIL) && prng() < accept;
   if(result) {
     sysPotRef = sysPotNew;
@@ -331,19 +328,19 @@
   if(abs(lbmax.x) > MIN_FORCE && abs(lbmax.x) < MAX_FORCE) {
     num.x = log(exp(-1.0 * lbmax.x ) + 2 * prng() * sinh(lbmax.x )) / lb.x;
   } else {
-    num.x = max * prng();
+    num.x = max * prng.Sym(1);
   }

   if(abs(lbmax.y) > MIN_FORCE && abs(lbmax.y) < MAX_FORCE){
     num.y = log(exp(-1.0 * lbmax.y ) + 2 * prng() * sinh(lbmax.y )) / lb.y;
   } else {
-    num.y = max * prng();
+    num.y = max * prng.Sym(1);
   }

   if(abs(lbmax.z) > MIN_FORCE && abs(lbmax.z) < MAX_FORCE){
     num.z = log(exp(-1.0 * lbmax.z ) + 2 * prng() * sinh(lbmax.z )) / lb.z;
   } else {
-    num.z = max * prng();
+    num.z = max * prng.Sym(1);
   }

   if(num.Length() >= boxDimRef.axis.Min(bPick)) {


same result

same result

--- src/moves/MultiParticle.h
+++ src/moves/MultiParticle.h
@@ -506,6 +506,10 @@
     num.z = max * rr;
   }

+  if(molIndex == 1) {
+    printf("CPU: %.15lf, %.15lf, %.15lf\n", num.x, num.y, num.z);
+  }
+
   if(num.Length() >= boxDimRef.axis.Min(bPick)) {
     std::cout << "Trial Displacement exceed half of the box length in Multiparticle move.\n";
     std::cout << "Trial transform: " << num;
@@ -545,9 +549,9 @@
 inline void MultiParticle::RotateForceBiased(uint molIndex)
 {
   XYZ rot = r_k.Get(molIndex);
-  if(molIndex == 1) {
-    printf("CPU: %.15lf, %.15lf, %.15lf\n", rot.x, rot.y, rot.z);
-  }
+  // if(molIndex == 1) {
+  //   printf("CPU: %.15lf, %.15lf, %.15lf\n", rot.x, rot.y, rot.z);
+  // }
   double rotLen = rot.Length();
   RotationMatrix matrix;


use appropriate argument when freeing association

--- src/netinet/sctp_output.c
+++ src/netinet/sctp_output.c
@@ -13765,7 +13765,7 @@

 			if (control) {
 				if (sctp_process_cmsgs_for_init(stcb, control, &error)) {
-					sctp_free_assoc(inp, stcb, SCTP_PCBFREE_FORCE,
+					sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC,
 					                SCTP_FROM_SCTP_OUTPUT + SCTP_LOC_6);
 					hold_tcblock = 0;
 					stcb = NULL;


net/netmgr: fix logging value in lwip func ioctl

fix logging value in lwip func ioctl

--- os/net/netmgr/netmgr_ioctl_lwip.c
+++ os/net/netmgr/netmgr_ioctl_lwip.c
@@ -343,7 +343,7 @@
 										req->msg.netdb.serv_name,
 										req->msg.netdb.ai_hint, &res);
 		if (req->req_res != 0) {
-			NET_LOGE(TAG, "lwip_getaddrinfo() returned with the error code: %d\n", ret);
+			NET_LOGE(TAG, "lwip_getaddrinfo() returned with the error code: %d\n", req->req_res);
 			req->msg.netdb.ai_res = NULL;
 		} else {
 			req->msg.netdb.ai_res = _netdev_copy_addrinfo(res);
@@ -383,7 +383,7 @@
 										req->msg.netdb.serv_len,
 										req->msg.netdb.flags);
 		if (req->req_res != 0) {
-			NET_LOGE(TAG, "lwip_getnameinfo() returned with the error code: %d\n", ret);
+			NET_LOGE(TAG, "lwip_getnameinfo() returned with the error code: %d\n", req->req_res);
 			ret = -EINVAL;
 		} else {
 			ret = OK;
@@ -396,7 +396,7 @@
 	case DHCPCSTART:
 		req->req_res = _netdev_dhcpc_start((const char *)req->msg.dhcp.intf);
 		if (req->req_res != OK) {
-			NET_LOGE(TAG, "Start DHCP clent failed\n");
+			NET_LOGE(TAG, "Start DHCP clent failed %d\n", req->req_res);
 			goto errout;
 		}
 		ret = OK;
@@ -404,7 +404,7 @@
 	case DHCPCSTOP:
 		req->req_res = _netdev_dhcpc_stop((const char *)req->msg.dhcp.intf);
 		if (req->req_res != OK) {
-			NET_LOGE(TAG, "Stop DHCP client failed\n");
+			NET_LOGE(TAG, "Stop DHCP client failed %d\n", req->req_res);
 			goto errout;
 		}
 		ret = OK;


transcode: don't fail spu track if we don't have something to render

SPU track works even if it doesn't have something to render at given time.
Fixes soverlay and subtitles in sout.

--- modules/stream_out/transcode/spu.c
+++ modules/stream_out/transcode/spu.c
@@ -129,7 +129,10 @@

     p_subpic = id->p_decoder->pf_decode_sub( id->p_decoder, &in );
     if( !p_subpic )
-        return VLC_EGENERIC;
+    {
+        /* We just don't have anything to handle now, go own*/
+        return VLC_SUCCESS;
+    }

     if( p_sys->b_master_sync && p_sys->i_master_drift )
     {


Update TODO

Update TODO

--- run_lsc.c
+++ run_lsc.c
@@ -21,18 +21,17 @@
  *
  * Correctness:
  *
- * - Don't commit stores and csr writes to memory until retirement
+ * - Introduce store buffers and only write store data to memory at retirement
  * - Force cosim match on IO memory locations (pick one to do IO and
  *   let the other follow)
  *
  * Perf:
  *
+ * - Allow loads to execute in the prescence of unretired, but non-overlapping stores
+ * - .... Further, allow loads to execute as long as all earlier stores have committed (and forward as needed)
+ * - crack stores into store data and store address
+ *
  * - Predict branches
- * - Reclaim physical registers a simpler way (push them to the tail
- *   of the freelist as soon as they are reallocated and roll back the
- *   tail on rollbacks)
- *
- * - crack stores and introduce store buffers
  * - LSC
  *
  * Cleanup:


DirectDraw: declaration cosmetics

DirectDraw: declaration cosmetics

Signed-off-by: Jean-Baptiste Kempf <7b85a41a628204b76aba4326273a3ccc74bd009a@videolan.org>

--- modules/video_output/msw/directx.c
+++ modules/video_output/msw/directx.c
@@ -171,11 +171,11 @@
     set_shortname( "DirectX" )
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VOUT )
-    add_bool( "directx-hw-yuv", 1, NULL, HW_YUV_TEXT, HW_YUV_LONGTEXT,
+    add_bool( "directx-hw-yuv", true, NULL, HW_YUV_TEXT, HW_YUV_LONGTEXT,
               true )
-    add_bool( "directx-use-sysmem", 0, NULL, SYSMEM_TEXT, SYSMEM_LONGTEXT,
+    add_bool( "directx-use-sysmem", false, NULL, SYSMEM_TEXT, SYSMEM_LONGTEXT,
               true )
-    add_bool( "directx-3buffering", 1, NULL, TRIPLEBUF_TEXT,
+    add_bool( "directx-3buffering", true, NULL, TRIPLEBUF_TEXT,
               TRIPLEBUF_LONGTEXT, true )

     add_string( "directx-device", "", NULL, DEVICE_TEXT, DEVICE_LONGTEXT,
@@ -183,10 +183,10 @@
         change_string_list( ppsz_dev, ppsz_dev_text, FindDevicesCallback )
         change_action_add( FindDevicesCallback, N_("Refresh list") )

-    add_bool( "directx-wallpaper", 0, NULL, WALLPAPER_TEXT, WALLPAPER_LONGTEXT,
+    add_bool( "directx-wallpaper", false, NULL, WALLPAPER_TEXT, WALLPAPER_LONGTEXT,
               true )

-    set_description( N_("DirectX video output") )
+    set_description( N_("DirectX (DirectDraw) video output") )
     set_capability( "video output", 100 )
     add_shortcut( "directx" )
     set_callbacks( OpenVideo, CloseVideo )


First proof of concept of simplest first-principles OoO execution

Worst known issues:
- execution forwards in zero cycles to the next
- loads completely ignore pending stores and goes straight to memory

This branch is a reaction to the mess that was the previous spagetti
code; there were too much cached state and derived.  A real
implementation needs this, but here we try to go bottom up: what is
the simplest implementation of (inefficient) OoO?

We admit a structure (the ROB) to hold all the instructions we aim to
execute, some of which might have been fetch from a misspeculated
branch.  Instructions in the ROB enter in program order, youngest in,
and, eventually, oldest out.

We also need the architectural state of the register file
which is the complete state of registers when the ROB is empty.

Any instruction in the ROB may be executed if all its dependencies are
satisfied, typically, each source register either isn't written by an
older instruction in the ROB or if it is, then the youngest of those
have executed (COMMITTED).

For loads, we also need to check all potentially overlapping older
stores in the ROB. If we can tell none can overlap, the load can
proceed.  If all overlapping stores have committed, then we can
calculate the part that needs to be forwarded and combined load data
(if necessary).  Otherwise, we must wait.

--- run_lsc.c
+++ run_lsc.c
@@ -16,6 +16,22 @@
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
+ *
+ *
+ * This branch goes in a different direction: what is the simplest
+ * possible we can do?  Try to minimize the state; all instruction are
+ * referred to by their sequence number.  A register is either retired
+ * and lives in the architecture file (ARF), otherwise it lives in the
+ * ROB (conceptually).
+ * Scheduling work straight out of the ROB.
+ *
+ * This eliminates freelist, simplifies rollback, make scheduling much
+ * simpler (for now).
+ *
+ * Once this model works, we can look at ways to improve it.
+ *
+ *  rob[rp] ... rob[wp-1] is the outstading non-retired instructions
+ *  we retire from the rp and insert new ones at the wp
  *
  *  ** TODO **
  *
@@ -61,25 +77,11 @@
 #define FETCH_BUFFER_SIZE      4
 #define FETCH_WIDTH            4
 #define ROB_SIZE               16 // <= 64 for now (using uint64_t as bitmasks)
-#define PHYSICAL_REGS          73 // XXX Should exclude the two reserved ones
-#define EX_BUFFER_SIZE         ROB_SIZE // XXX same, for now
-#define ME_BUFFER_SIZE         28
-
-/*
- * Early release frees the old physical register at allocation time
- * and roll-back then have to undo that (but this is cheap).
- */
-
-static const bool debug_freelist = false;
-
-bool CONFIG_EARLY_RELEASE;
-//#define EARLY_RELEASE           1

 // Two special physical registers: the constant zero and the sink for
 // for r0 destination (it's never read)

 #define PR_ZERO                 0
-#define PR_SINK (PHYSICAL_REGS-1)

 //////// Types

@@ -97,30 +99,10 @@
 //  uint64_t            retire_ts; // This is implicit
 } fetch_parcel_t;

-/* The essence of support for speculation is the register renaming and
- * the reorder buffer.  The former enables us a overlap future and
- * past values of logical registers whereas the reorder buffer is
- * allocated in program order and enables us to restore the sequential
- * view and roll-back mis-speculation.
- *
- * Renaming is just mapping logical registers to physical.  The
- * reorder buffer tracks instructions in flight, what the _previous_
- * register was that was assigned to a logical register, and whether
- * the instruction has committed.
- *
- * Committed instructions from the tail of the ROB can be retired,
- * which means the old register is freed and the entry disappears from
- * the ROB.
- *
- * Rolling back means traversing backwards from the head, undoing the
- * renames and freeing the registers.
- */
 typedef struct rob_entry_st {
-    int                 r;      /* Logical register written by this instruction */
-    int                 pr;     /* Physical register that r is mapped to */
-    int                 pr_old; /* Physical register that r was _previously_ mapped to */
     bool                committed; /* The instruction is done executing and has written the result, if any, to the
                                     * register file */
+    uint64_t            result; // ~ prf

     bool                restart;
     uint64_t            restart_pc;
@@ -128,7 +110,7 @@

     uint64_t            store_addr;
-    int                 store_data_pr;
+
     // For cosim
     bool                mmio; // force reference model to follow us

@@ -149,112 +131,38 @@

 //////// State

-/* The arrays */
+static const arch_t    *arch;
+
 static fetch_parcel_t   fb[FETCH_BUFFER_SIZE];
-static rob_entry_t      rob[ROB_SIZE];
-static unsigned         map[32];
-static unsigned         art[32];
-static int64_t          prf[PHYSICAL_REGS];
-static bool             pr_ready[PHYSICAL_REGS]; // Scoreboard
-static bool             pr_ready_next[PHYSICAL_REGS]; // Scoreboard
-static unsigned         freelist[PHYSICAL_REGS];
-static micro_op_t       ex_buffer[EX_BUFFER_SIZE];
-static micro_op_t       me_buffer[ME_BUFFER_SIZE];
-
-/*
- * A CAM-free, constant-time, RAM based scheduler organizes the
- * waitlist (wait set) in three parts based on the number of operands
- * that are still outstanding:
- *
- * - needs0 (AKA, ready, waiting for nothing)
- * - needs1
- * - needs2
- *
- * When a physical register gets defined, all of the depending
- * instructions moves up in the hierarchy: the ones in needs1 become
- * ready, the somes in needs2 moves to needs1.
- *
- * We maintain a map from phys. registers to dependent instructions.
- * As instructions can start in needs2 migrate to needs1, we'd need to
- * update this map both rename time and execute.
- *
- * For now we implement the sets with bitmaps (and thus require
- * EX_BUFFER_SIZE <= 64), but eventually we'll make everything RAM
- * based.
- */
-static uint64_t         ex_needs[3];
-
-// depends[pr], the set of instructions in ex_needsX waiting on pr
-static uint64_t         depends[PHYSICAL_REGS];
-
-static const arch_t    *arch;
 static unsigned         fetch_seqno;
 static int              fb_rp = 0, fb_wp = 0, fb_size = 0;
+
+static int64_t          art[32]; // register -> retired value
+
+static rob_entry_t      rob[ROB_SIZE];
 static unsigned         rob_wp = 0, rob_rp = 0;
-static unsigned         freelist_wp = 0, freelist_rp = 0;
-static int              ex_size;
-static int              me_size;
+static unsigned         rob_wp_seqno_offset = 0;
+static unsigned         rob_rp_seqno_offset = 0;

 static uint64_t         exception_seqno = ~0ULL;
 static isa_exception_t  exception_info;

 static int              n_cycles;
 static int              n_pending_stores;
-static int              n_free_regs;
-static int              n_regs_in_flight;
-
-static char             letter_size[256] = {
-    [1] = 'B',
-    [2] = 'H',
-    [4] = 'W',
-    [8] = 'D',
-};
-
-#define popcount __builtin_popcount

 ///////////////////////////////////////////////////////

-#define EX_INV() ex_check(__FILE__, __LINE__)
+static bool
+is_rob_full(void)
+{
+    return (rob_wp + 1) % ROB_SIZE == rob_rp;
+}
+

 static void dump_microarch_state(void)
 {
-    // Scoreboard, without the retired regs
-    printf("         Scoreboard Ready Regs in flight:");
-    for (int pr = 0; pr < PHYSICAL_REGS; ++pr) {
-        int logical = 0;
-        if (pr_ready[pr]) {
-            for (int r = 0; r < 32; ++r)
-                if (map[r] == pr)
-                    logical = 32*logical + r; // catch multiple mappings to same pr
-            for (int r = 0; r < 32; ++r)
-                if (art[r] == pr)
-                    goto skip;
-            printf(" p%d(x%d)", pr, logical);
-skip:;
-        }
-    }
-    printf("\n");
-
     // FB
     printf("         FB size %d, ", fb_size);
-    printf("EX size %d: %08lx/%08lx/%08lx, ", ex_size, ex_needs[0], ex_needs[1], ex_needs[2]);
-    printf("ME size %d, ", me_size);
-    printf("Regs free %d (- in flight = %d)\n", n_free_regs, n_free_regs - n_regs_in_flight - 1);
-
-    // EX
-
-    for (int i = 0; i < EX_BUFFER_SIZE; ++i)
-        if ((ex_needs[0] | ex_needs[1] | ex_needs[2]) & (1l << i)) {
-            micro_op_t mop = ex_buffer[i];
-            int missing = 2 * ((ex_needs[2] >> i) & 1) + ((ex_needs[1] >> i) & 1);
-            printf("         EX[%02d] (missing %d {", i, missing);
-            for (int j = 0; j < PHYSICAL_REGS; ++j)
-                if (depends[j] & (1ULL << i))
-                    printf(" x%d", j);
-            printf("} ");
-
-            isa_disass(stdout, arch, mop.dec, (isa_result_t) { .result = 0 });
-        }

     // ROB
     for (int p = rob_rp; p != rob_wp;) {
@@ -269,114 +177,6 @@
     }
 }

-static void ex_check(const char *file, unsigned line)
-{
-    // INV: Disjunctive union of ex_size bits
-    if (popcount(ex_needs[0] | ex_needs[1] | ex_needs[2]) != ex_size ||
-        (ex_needs[0] & ex_needs[1]) || (ex_needs[1] & ex_needs[2]) || (ex_needs[0] & ex_needs[2])) {
-
-        printf("%s:%d: EX %d %08lx/%08lx/%08lx\n", file, line, ex_size,
-               ex_needs[0], ex_needs[1], ex_needs[2]);
-
-        dump_microarch_state();
-        fflush(stdout);
-        exit(-1);
-    }
-}
-
-
-static bool
-is_rob_full(void)
-{
-    return (rob_wp + 1) % ROB_SIZE == rob_rp;
-}
-
-static void
-assert_not_in_freelist(int x)
-{
-    int p = freelist_rp;
-    while (p != freelist_wp) {
-        if (freelist[p] == x)
-            fprintf(stderr, "%05d [FAILURE p%d in already free at pos %d\n",
-                    n_cycles, x, p);
-        assert(freelist[p] != x);
-	if (++p == sizeof freelist / sizeof *freelist)
-	    p = 0;
-    }
-}
-
-#define assert_ne(a, b)                                 \
-    ({long long __a = (a), __b = (b);                   \
-    if (__a == __b) {                                   \
-        fprintf(stderr, "%lld == %lld\n", __a, __b);    \
-    assert(a != b); }})
-
-static void
-free_reg(unsigned pr)
-{
-    assert((unsigned) pr < PHYSICAL_REGS);
-    if (pr == PR_ZERO || pr == PR_SINK)
-	return;
-
-    if (debug_freelist)
-    fprintf(stderr, "%05d [free  p%02d; %d/%d FL %d-%d]\n",
-            n_cycles, pr, n_free_regs, n_regs_in_flight,
-            freelist_rp, freelist_wp);
-
-    assert_not_in_freelist(pr);
-
-    freelist[freelist_wp] = pr;
-    if (++freelist_wp == sizeof freelist / sizeof *freelist)
-        freelist_wp = 0;
-    ++n_free_regs;
-
-    assert(freelist_rp != freelist_wp);
-    assert(0 <= n_free_regs && n_free_regs <= PHYSICAL_REGS - 2);
-    assert((PHYSICAL_REGS + freelist_wp - freelist_rp) % PHYSICAL_REGS == n_free_regs);
-}
-
-static unsigned
-alloc_reg(void)
-{
-    assert(freelist_rp != freelist_wp);
-
-    unsigned pr = freelist[freelist_rp++];
-    if (freelist_rp == sizeof freelist / sizeof *freelist)
-        freelist_rp = 0;
-    pr_ready_next[pr] = false;
-    --n_free_regs;
-
-    if (debug_freelist)
-    fprintf(stderr, "%05d [alloc p%02d; %d/%d FL %d-%d]\n",
-            n_cycles, pr, n_free_regs, n_regs_in_flight,
-            freelist_rp, freelist_wp);
-    assert(0 <= n_free_regs && n_free_regs <= PHYSICAL_REGS - 2);
-    assert((PHYSICAL_REGS + freelist_wp - freelist_rp) % PHYSICAL_REGS == n_free_regs);
-
-    return pr;
-}
-
-static unsigned
-allocate_rob(int r, int pr, int pr_old, fetch_parcel_t fp)
-{
-    unsigned rob_index = rob_wp;
-
-    assert(r == ISA_NO_REG || (unsigned) r < 32);  // XXX should be part of the arch
-    assert((unsigned) pr < PHYSICAL_REGS);
-
-    rob[rob_index] = (rob_entry_t) {
-        .r = r, .pr = pr, .pr_old = pr_old, .committed = false,
-        .fp = fp
-    };
-
-    if (++rob_wp == ROB_SIZE)
-        rob_wp = 0;
-
-    assert(rob_wp != rob_rp);
-
-    return rob_index;
-}
-
 static void
 visualize_retirement(cpu_state_t *state, rob_entry_t rob)
 {
@@ -385,7 +185,6 @@
     char line[WIDTH+1];
     fetch_parcel_t fp = rob.fp;
     isa_decoded_t dec = rob.dec;
-    int            pr = rob.pr;

     memset(line, '.', WIDTH);
     line[WIDTH] = '\0';
@@ -397,29 +196,18 @@
     line[fp.commit_ts  % WIDTH] = 'C';
     line[n_cycles         % WIDTH] = 'R';

-    printf("%5d ", n_cycles);
+    printf("%3d ", n_cycles);
+    printf("%3d ", fp.seqno);
+    printf("%s ",  line);

 #if 0
-    printf("%5d ", fp.seqno);
+    if (dec.dest_reg != ISA_NO_REG)
+        printf("r%02d:p%02d ", dec.dest_reg, pr);
+    else
+        printf("        ");
 #endif

-    printf("%s ", line);
-
-#if 1
-    if (pr != PR_SINK)
-        printf("r%02d:p%02d>p%02d ", dec.dest_reg, rob.pr_old, pr);
-    else
-        printf("            ");
-#endif
-    isa_disass(stdout, arch, dec, (isa_result_t) { .result = prf[pr] });
-
-#if 0
-    for (int p = freelist_rp; p != freelist_wp;) {
-        printf(" %d", freelist[p]);
-        if (++p == sizeof freelist / sizeof *freelist) p = 0;
-    }
-    printf("\n");
-#endif
+    isa_disass(stdout, arch, dec, (isa_result_t) { .result = rob.result /* XXX MSR result */ });
 }

@@ -438,80 +226,25 @@
 rollback_rob(int keep_rob_index, verbosity_t verbosity)
 {
     do {
-        if (0)
-        fprintf(stderr, "%05d [ROB colla, %d rob entries, regs: %d free, %d in-flight; FL %d-%d]\n",
-                n_cycles,
-                (ROB_SIZE + rob_wp - rob_rp) % ROB_SIZE,
-                n_free_regs, n_regs_in_flight,
-                freelist_rp, freelist_wp);
-
         unsigned p = rob_wp;
-        if (p-- == 0)
+        unsigned p_offset = rob_wp_seqno_offset;
+        if (p-- == 0) {
             p = ROB_SIZE - 1;
+            p_offset -= ROB_SIZE;
+        }

         assert((unsigned)p < ROB_SIZE);
         if (p == keep_rob_index)
             break;
         rob_wp = p;
-
+        rob_wp_seqno_offset = p_offset;
+
+/* XXX don't recall why I did that
         if (rob[p].r == ISA_NO_REG)
             continue;
-
-        if (CONFIG_EARLY_RELEASE) {
-            // Undo the free'd register and the allocation
-            assert(freelist_wp != freelist_rp);
-            if (freelist_wp-- == 0)
-                freelist_wp = sizeof freelist / sizeof *freelist - 1;
-
-            assert_not_in_freelist(map[rob[p].r]);
-
-            if (freelist_rp-- == 0)
-                freelist_rp = sizeof freelist / sizeof *freelist - 1;
-
-            if (map[rob[p].r] != freelist[freelist_rp])
-                fprintf(stderr, "      map[r%d] (p%d) != freelist[%d] (p%d)\n",
-                        rob[p].r, map[rob[p].r], freelist_rp, freelist[freelist_rp]);
-
-            assert(map[rob[p].r] == freelist[freelist_rp]);
-
-            --n_regs_in_flight;
-
-            if (debug_freelist)
-            fprintf(stderr, "%05d [rollback: unalloc p%02d/unfree p%02d; %2d/%2d; %2d-%2d]\n",
-                    n_cycles,
-                    freelist[freelist_rp],
-                    freelist[freelist_wp],
-                    n_free_regs, n_regs_in_flight,
-                    freelist_rp, freelist_wp);
-            assert(0 <= n_regs_in_flight && n_free_regs - n_regs_in_flight <= PHYSICAL_REGS - 2);
-            assert((PHYSICAL_REGS + freelist_wp - freelist_rp) % PHYSICAL_REGS == n_free_regs);
-        } else {
-            // free_reg(map[rob[p].r]);
-            // We _should_ be able to just unallocate it?
-            if (freelist_rp-- == 0)
-                freelist_rp = sizeof freelist / sizeof *freelist - 1;
-            ++n_free_regs;
-            assert(map[rob[p].r] == freelist[freelist_rp]);
-
-    if (debug_freelist)
-            fprintf(stderr,
-                    "%05d [rollback: unalloc p%02d; %2d/%2d; %2d-%2d]\n",
-                    n_cycles,
-                    freelist[freelist_rp],
-                    n_free_regs, n_regs_in_flight,
-                    freelist_rp, freelist_wp);
-        }
-
-        map[rob[p].r] = rob[p].pr_old;
+*/
+
     } while (rob_rp != rob_wp);
-
-    if (memcmp(map, art, sizeof map) != 0) {
-        fprintf(stderr, "Uh oh:\n");
-        for (int i = 0; i < 32; ++i)
-            if (map[i] != art[i])
-                fprintf(stderr, "  map[%d] = %d, but art[%d] = %d\n", i, map[i], i, art[i]);
-    }
-    assert(memcmp(map, art, sizeof map) == 0);

     exception_seqno = ~0ULL;
     n_pending_stores = 0;
@@ -524,20 +257,41 @@
     // Flush
     fb_size = 0;
     fb_rp = fb_wp;
-    ex_size = 0;
-    me_size = 0;
-    ex_needs[0] = ex_needs[1] = ex_needs[2] = 0;
-
-    EX_INV();

     rollback_rob(rob_index, verbosity);

     state->pc = new_pc;
     fetch_seqno = seqno + 1;
     // mispredicted = true;
-
-}
-
+}
+
+
+/* All register values can be found by just scanning the ROB backward from the refering instruction */
+static int64_t
+get_reg(unsigned rob_index, int r, bool *ready)
+{
+    *ready = false;
+    if (r == 0) {
+        *ready = true;
+        return 0;
+    }
+
+    unsigned p = rob_index;
+    do {
+        if (p == 0)
+            p = ROB_SIZE - 1;
+        else
+            --p;
+
+        if (rob[p].dec.dest_reg == r) {
+            *ready = rob[p].committed;
+            return rob[p].result;
+        }
+    } while (p != rob_rp);
+
+    *ready = true;
+    return art[r];
+}

 /*
  * The ReOrder Buffer holds instructions in fetch (= program) order.
@@ -582,12 +336,15 @@

         if (re.dec.class == isa_insn_class_store && !re.exception) {

-            assert(pr_ready[re.store_data_pr]);
             assert(0 < n_pending_stores);

             isa_exception_t exc = { 0 };
-            arch->store(state, re.store_addr, prf[re.store_data_pr],
+            bool ready_b;
+            arch->store(state,
+                        re.store_addr,
+                        get_reg(rob_rp, re.dec.source_reg_b, &ready_b),
                         re.dec.loadstore_size, &exc);
+            assert(ready_b);
             --n_pending_stores;

             if (exc.raised) {
@@ -601,7 +358,14 @@
                 fprintf(stderr, "                  EXCEPTION %"PRId64" (%08"PRId64") RAISED\n",
                         exception_info.code, exception_info.info);

-            int prev_rob_rp = rob_rp == 0 ? ROB_SIZE - 1 : rob_rp - 1;
+            int prev_rob_rp_offset = rob_rp_seqno_offset;
+            int prev_rob_rp = rob_rp - 1;
+
+            if (rob_rp == 0) {
+                prev_rob_rp = ROB_SIZE - 1;
+                prev_rob_rp_offset -= ROB_SIZE;
+            }
+
             //assert(state->msr[0x300] == costate->msr[0x300]);
             flush_and_redirect(state, verbosity, prev_rob_rp, re.fp.seqno - 1,
                                arch->handle_exception(state, re.dec.insn_addr, exception_info));
@@ -611,8 +375,8 @@
             break;
         }

-        if (re.r != ISA_NO_REG) {
-            art[re.r] = re.pr;
+        if (re.dec.dest_reg != ISA_NO_REG) {
+            art[re.dec.dest_reg] = re.result;
         }

         if (re.restart) {
@@ -632,8 +396,8 @@

         bool override = re.mmio;

-        if (override && re.r != ISA_NO_REG)
-            costate->r[re.r] = prf[re.pr];
+        if (override && re.dec.dest_reg != ISA_NO_REG)
+            costate->r[re.dec.dest_reg] = re.result;

         if (re.dec.insn_addr != copc) {
             fprintf(stderr, "COSIM: REF PC %08"PRIx64" != LSC PC %08"PRIx64"\n",
@@ -641,24 +405,17 @@
             assert(re.dec.insn_addr == copc);
         }

-        if (re.r != ISA_NO_REG && prf[re.pr] != costate->r[re.r]) {
-            fprintf(stderr, "COSIM: REF RES %08"PRIx64" != LSC RES %08"PRIx64"\n",
-                    costate->r[re.r] & 0xFFFFFFFF, prf[re.pr] & 0xFFFFFFFF);
-            assert(prf[re.pr] == costate->r[re.r]);
-        }
-
-        if (CONFIG_EARLY_RELEASE) {
-            if (re.r != ISA_NO_REG) {
-                --n_regs_in_flight;
-                assert(0 <= n_regs_in_flight && n_free_regs - n_regs_in_flight <= PHYSICAL_REGS - 2);
-                assert((PHYSICAL_REGS + freelist_wp - freelist_rp) % PHYSICAL_REGS == n_free_regs);
+        if (re.dec.dest_reg != ISA_NO_REG) {
+            if (re.result != costate->r[re.dec.dest_reg]) {
+                fprintf(stderr, "COSIM: REF RES %08"PRIx64" != LSC RES %08"PRIx64"\n",
+                        costate->r[re.dec.dest_reg] & 0xFFFFFFFF,
+                        re.result);
+                assert(re.result == costate->r[re.dec.dest_reg]);
             }
-        } else {
-            free_reg(re.pr_old);
         }

         if (++rob_rp == ROB_SIZE)
-            rob_rp = 0;
+            rob_rp = 0, rob_rp_seqno_offset += ROB_SIZE;
     }

     static int deadcycles = 0;
@@ -718,11 +475,7 @@
     /*
      * Decode and rename
      */
-    while (0 < fb_size &&
-           ex_size < EX_BUFFER_SIZE &&
-           me_size < ME_BUFFER_SIZE &&
-           !is_rob_full() &&
-           n_regs_in_flight + 1 < n_free_regs) {
+    while (0 < fb_size && !is_rob_full()) {

         fetch_parcel_t fetched = fb[fb_rp];
         isa_decoded_t dec      = arch->decode(fetched.addr, fetched.insn);
@@ -730,8 +483,11 @@
         // Serialize system instruction; block issuing until all
         // previous instructions have executed (really, retired) and then only allow a single one in

-        if (dec.system && (ex_size > 0 || me_size > 0))
-            break;
+/* XXX later
+   if (dec.system)
+   // Check if there are other ready instructions
+   break;
+*/

         if (++fb_rp == FETCH_BUFFER_SIZE)
             fb_rp = 0;
@@ -739,58 +495,18 @@

         fetched.decode_ts = n_cycles;

-        int           old_pr    = dec.dest_reg != ISA_NO_REG ? map[dec.dest_reg] : PR_SINK;
-        int           pr        = dec.dest_reg != ISA_NO_REG ? alloc_reg()       : PR_SINK;
-        unsigned      rob_index = allocate_rob(dec.dest_reg, pr, old_pr, fetched);
-
-        // Rename (XXX backpressure)
-        micro_op_t mop = {
-            .fetched = fetched,
-            .dec     = dec,
-            .pr_a    = map[dec.source_reg_a],
-            .pr_b    = map[dec.source_reg_b],
-            .pr_wb   = pr,
-            .rob_index = rob_index
+        rob[rob_wp] = (rob_entry_t) {
+            .committed = false,
+            .fp = fetched,
+            .dec = dec
         };

-        if (CONFIG_EARLY_RELEASE) {
-            if (old_pr != PR_SINK && old_pr != PR_ZERO) {
-                free_reg(old_pr);
-                ++n_regs_in_flight;
-            }
-        }
-
-        if (dec.dest_reg != ISA_NO_REG) {
-            map[dec.dest_reg] = mop.pr_wb;
-        }
-
-        rob[rob_index].dec = dec;
-        rob[rob_index].pr = mop.pr_wb;
-
-        if (dec.class == isa_insn_class_load || dec.class == isa_insn_class_store)
-            me_buffer[me_size++] = mop;
-        else {
-            // XXX for now, just organize the ex_buffer by rob id, to
-            // avoid having to many indicies to worry about.
-            ex_buffer[rob_index] = mop;
-            if (!pr_ready[mop.pr_a]) depends[mop.pr_a] |= 1ULL << rob_index;
-            if (!pr_ready[mop.pr_b]) depends[mop.pr_b] |= 1ULL << rob_index;
-
-            int dep = !pr_ready[mop.pr_a];
-            dep += !pr_ready[mop.pr_b] && mop.pr_b != mop.pr_a;
-            EX_INV();
-            ex_needs[dep] |= 1ULL << rob_index;
-            ex_size++;
-            EX_INV();
-        }
-
-        if (0)
-        fprintf(stderr, "%05d [ROB alloc, %d rob entries, regs: %d free, %d in-flight; FL %d-%d]\n",
-                n_cycles,
-                (ROB_SIZE + rob_wp - rob_rp) % ROB_SIZE,
-                n_free_regs, n_regs_in_flight,
-                freelist_rp, freelist_wp);
-        assert((PHYSICAL_REGS + freelist_wp - freelist_rp) % PHYSICAL_REGS == n_free_regs);
+        assert(fetched.seqno == rob_wp + rob_wp_seqno_offset);
+
+        if (++rob_wp == ROB_SIZE)
+            rob_wp = 0, rob_wp_seqno_offset += ROB_SIZE;
+
+        assert(rob_wp != rob_rp);
     }
 }

@@ -802,17 +518,16 @@
     return addr < 0x80000000;
 }

-static void
-lsc_exec1(cpu_state_t *state, verbosity_t verbosity, micro_op_t mop)
-{
-    assert(mop.fetched.addr == mop.dec.insn_addr);
-
+static bool
+lsc_exec1(cpu_state_t *state, verbosity_t verbosity, unsigned rob_index,
+          uint64_t op_a, uint64_t op_b)
+{
+    rob_entry_t re = rob[rob_index];
+    isa_decoded_t dec = re.dec;
     isa_exception_t exc = { 0 };
-    uint64_t op_a  = prf[mop.pr_a];
-    uint64_t op_b  = prf[mop.pr_b];
     uint64_t msr_a =
-        mop.dec.source_msr_a != ISA_NO_REG
-        ? arch->read_msr(state, mop.dec.source_msr_a, &exc)
+        dec.source_msr_a != ISA_NO_REG
+        ? arch->read_msr(state, dec.source_msr_a, &exc)
         : 0;

     uint64_t atomic_load_addr = op_a;
@@ -821,27 +536,30 @@
     if (exc.raised)
         goto exception;

-    if (mop.dec.class == isa_insn_class_atomic)
-        op_a = arch->load(state, atomic_load_addr, mop.dec.loadstore_size, &exc);
+    if (dec.class == isa_insn_class_atomic)
+        op_a = arch->load(state, atomic_load_addr, dec.loadstore_size, &exc);

     if (exc.raised)
         goto exception;

     isa_result_t res;

-    if (!mop.dec.system)
-        res = arch->insn_exec(mop.dec, op_a, op_b, msr_a, &exc);
+    if (!dec.system)
+        res = arch->insn_exec(dec, op_a, op_b, msr_a, &exc);
     else
-        res = arch->insn_exec_system(state, mop.dec, op_a, op_b, msr_a, &exc);
+        res = arch->insn_exec_system(state, dec, op_a, op_b, msr_a, &exc);
     res.result = CANONICALIZE(res.result);

     if (exc.raised)
         goto exception;

-    switch (mop.dec.class) {
+    switch (dec.class) {
     case isa_insn_class_load:
+        // XXXXXXXXXX
+        // XXXX We need to examine pending stores and forward as necessary XXX
+        // XXX THIS IS KNOWN WRONG
         res.load_addr = CANONICALIZE(res.load_addr);
-        res.result = arch->load(state, res.load_addr, mop.dec.loadstore_size, &exc);
+        res.result = arch->load(state, res.load_addr, dec.loadstore_size, &exc);
         res.result = CANONICALIZE(res.result);
         mmio = is_mmio_space(state, res.load_addr);

@@ -851,13 +569,15 @@
         break;

     case isa_insn_class_store:
-        assert(0);
+        // XXX could check the address for exceptions
+        rob[rob_index].store_addr = CANONICALIZE(res.store_addr);
+        ++n_pending_stores;
         break;

     case isa_insn_class_atomic:
         // XXX ??
         res.load_addr = CANONICALIZE(res.load_addr);
-        arch->store(state, atomic_load_addr, res.result, mop.dec.loadstore_size, &exc);
+        arch->store(state, atomic_load_addr, res.result, dec.loadstore_size, &exc);

         if (exc.raised)
             goto exception;
@@ -873,136 +593,92 @@

     case isa_insn_class_branch:
         if (res.branch_taken) {
-            rob[mop.rob_index].restart = true;
-            rob[mop.rob_index].restart_pc = mop.dec.jumpbranch_target;
+            rob[rob_index].restart = true;
+            rob[rob_index].restart_pc = dec.jumpbranch_target;
         }
         break;

     case isa_insn_class_jump: {
-            rob[mop.rob_index].restart = true;
-            rob[mop.rob_index].restart_pc = mop.dec.jumpbranch_target;
+            rob[rob_index].restart = true;
+            rob[rob_index].restart_pc = dec.jumpbranch_target;
         }
         break;

     case isa_insn_class_compjump: {
-            rob[mop.rob_index].restart = true;
-            rob[mop.rob_index].restart_pc = res.compjump_target;
+            rob[rob_index].restart = true;
+            rob[rob_index].restart_pc = res.compjump_target;
         }
         break;
     }

-    prf[mop.pr_wb] = res.result;
-    pr_ready_next[mop.pr_wb] = true;
-
-    EX_INV();
-
-    ex_needs[0] |= ex_needs[1] & depends[mop.pr_wb];
-    ex_needs[1] &= ~depends[mop.pr_wb];
-
-    ex_needs[1] |= ex_needs[2] & depends[mop.pr_wb];
-    ex_needs[2] &= ~depends[mop.pr_wb];
-
-    EX_INV();
-
-    if (mop.dec.dest_msr != ISA_NO_REG)
-        arch->write_msr(state, mop.dec.dest_msr, res.msr_result, &exc);
+    rob[rob_index].result = res.result;
+
+    if (dec.dest_msr != ISA_NO_REG)
+        arch->write_msr(state, dec.dest_msr, res.msr_result, &exc);

     // Flush the pipe on system instructions unless is a compjump
-    if (mop.dec.system && mop.dec.class != isa_insn_class_compjump) {
-        rob[mop.rob_index].restart = true;
-        rob[mop.rob_index].restart_pc = mop.dec.insn_addr + 4;
+    if (dec.system && dec.class != isa_insn_class_compjump) {
+        rob[rob_index].restart = true;
+        rob[rob_index].restart_pc = dec.insn_addr + 4;
     }

 exception:
-    rob[mop.rob_index].committed = true;
-    rob[mop.rob_index].mmio = mmio;
+    rob[rob_index].committed = true;
+    rob[rob_index].mmio = mmio;

     if (exc.raised) {
-        rob[mop.rob_index].exception = true;
-
-        if (mop.fetched.seqno < exception_seqno) {
-            exception_seqno = mop.fetched.seqno;
+        rob[rob_index].exception = true;
+
+        unsigned seqno = rob_index + rob_rp_seqno_offset;
+        assert(rob[rob_index].fp.seqno == seqno);
+
+        if (seqno < exception_seqno) {
+            exception_seqno = seqno;
             exception_info  = exc;
         }
     }
+
+    return true;
 }

 static void
 lsc_execute(cpu_state_t *state, verbosity_t verbosity)
 {
-    uint64_t ready_to_run = ex_needs[0];
-
-    /* Schedule and Execute */
-    for (int i = 0; i < EX_BUFFER_SIZE; ++i)
-        if ((1ULL << i) & ready_to_run) {
-            EX_INV();
-            ex_needs[0] &= ~(1ULL << i);
-            --ex_size;
-            EX_INV();
-
-            lsc_exec1(state, verbosity, ex_buffer[i]);
-            rob[i].fp.execute_ts = n_cycles;
-            rob[i].fp.commit_ts = n_cycles;
-        }
-
-    // ME has to be in order
-    int p;
-    for (p = 0; p < me_size; ++p) {
-        micro_op_t mop = me_buffer[p];
-
-        if (mop.dec.class == isa_insn_class_store) {
-            if (!pr_ready[mop.pr_a])
-                break;
-
-            uint64_t op_a = prf[mop.pr_a];
-            isa_exception_t exc = { 0 };
-            isa_result_t res = arch->insn_exec(mop.dec, op_a, 0, 0, &exc);
-
-            // Don't actually perform the store until retirement
-            rob[mop.rob_index].store_addr = CANONICALIZE(res.store_addr);
-            rob[mop.rob_index].store_data_pr = mop.pr_b;
-            rob[mop.rob_index].fp.execute_ts = n_cycles;
-            rob[mop.rob_index].fp.commit_ts = n_cycles;
-            rob[mop.rob_index].committed = true;
-
-            if (exc.raised) {
-                rob[mop.rob_index].exception = true;
-
-                if (mop.fetched.seqno < exception_seqno) {
-                    exception_seqno = mop.fetched.seqno;
-                    exception_info  = exc;
+    for (unsigned p = rob_rp; p != rob_wp; p = p == ROB_SIZE - 1 ? 0 : p + 1) {
+        rob_entry_t re = rob[p];
+        bool ready_a, ready_b;
+        int64_t val_a = get_reg(p, re.dec.source_reg_a, &ready_a);
+        int64_t val_b = get_reg(p, re.dec.source_reg_b, &ready_b);
+
+        // Stores are special and execute the address calculation even
+        // if the data isn't ready.  Loads have additional dependency
+        // on stores.
+
+        if (re.dec.class == isa_insn_class_store && !ready_a)
+            continue;
+        else if (!ready_a || !ready_b)
+            continue;
+
+        if (!lsc_exec1(state, verbosity, p, val_a, val_b))
+            // Loads may not be able to execute yet
+            continue;
+
+        rob[p].fp.execute_ts = n_cycles;
+        rob[p].fp.commit_ts = n_cycles;
+
+#if 0
+        if (exc.raised) {
+            rob[p].exception = true;
+
+            if (re.fp.seqno < exception_seqno) {
+                exception_seqno = re.fp.seqno;
+                exception_info  = exc;
                 }
             }
-
             ++n_pending_stores;
             continue;
-        }
-
-        if (mop.dec.class == isa_insn_class_load && 0 < n_pending_stores) {
-            if (0 & verbosity & VERBOSE_DISASS)
-                fprintf(stderr, "%08x L%c blocked by %d pending stores\n",
-                       (uint32_t) mop.fetched.addr,
-                       letter_size[mop.dec.loadstore_size],
-                       n_pending_stores);
-            break;
-        }
-
-        if (!pr_ready[mop.pr_a] | !pr_ready[mop.pr_b])
-            break;
-
-        lsc_exec1(state, verbosity, me_buffer[p]);
-        rob[mop.rob_index].fp.execute_ts = n_cycles;
-        rob[mop.rob_index].fp.commit_ts = n_cycles;
-    }
-
-    if (p == 0)
-        return;
-
-    // Compress out executed instructions
-
-    for (int j = 0; j + p < me_size; ++j)
-        me_buffer[j] = me_buffer[j + p];
-    me_size -= p;
+#endif
+    }
 }

 static bool
@@ -1010,8 +686,6 @@
     cpu_state_t *state, cpu_state_t *costate,
     verbosity_t verbosity)
 {
-    memcpy(pr_ready, pr_ready_next, sizeof pr_ready);
-
     lsc_retire(state, costate, verbosity);
     lsc_execute(state, verbosity);
     lsc_decode_rename(state, verbosity);
@@ -1043,25 +717,6 @@
     uint64_t tohost = 0;
     getelfsym(&info, "tohost", &tohost);

-    /* pr_ready and reservation station initialization */
-    memset(pr_ready_next, 0, sizeof pr_ready_next);
-    pr_ready_next[PR_ZERO] = true;
-
-    freelist_wp = freelist_rp = n_free_regs = n_regs_in_flight = 0;
-
-    for (unsigned pr = 1; pr < PR_SINK; ++pr) {
-        free_reg(pr);
-    }
-
-    map[0] = PR_ZERO;
-    for (int i = 1; i < 32; ++i) {
-        int pr       = alloc_reg();
-        map[i]       = pr;
-        prf[pr]      = state->r[i];
-        pr_ready_next[pr] = true;
-    }
-
-    memcpy(art, map, sizeof art);
     for (n_cycles = 0;; ++n_cycles) {
         if (step_lsc(state, costate, verbosity))
             break;


Reinstate revision 1.11:
BDECFLAGS; ANSIfy; use EXEC instead of "exec " where appropriate; use
proper types (size_t, int); use proper variable names for certain things;
get rid of static 'cache' style stuff by moving and sanitizing the
original SHELL checking code to main(), this also makes it easier to
free() the string; rename file-scope system() to exec_shell(); use
snprintf() everywhere instead of sprintf(); actually remember to free()
other malloc()'d char pointers in main().

I left out the -s option in this revision along with getusershell()
checking because of objections made by Warner Losh <imp> and Garrett
Wollman <wollman>.  I agreed with their assertions that such code was
unnecessary in a program like this.

I dare people to make this coredump now.

Some suggestions:	nectar (snprintf() truncate checking)
Reviewed by:		markm, eivind, jedgar
Tortured by:		examples in apply(1), fuzz(1),
			and a lot of random ideas I came up with

--- usr.bin/apply/apply.c
+++ usr.bin/apply/apply.c
@@ -55,16 +55,16 @@
 #include <string.h>
 #include <unistd.h>

-void	usage __P((void));
-int	system __P((const char *));
+void			usage(void);
+static int		exec_shell(char *, char *, const char *);
+
+#define	EXEC	"exec "

 int
-main(argc, argv)
-	int argc;
-	char *argv[];
-{
-	int ch, clen, debug, i, l, magic, n, nargs, rval;
-	char *c, *cmd, *p, *q;
+main(int argc, char **argv) {
+	int ch, debug, i, magic, n, nargs, rval, offset;
+	size_t clen, l, cmdsize;
+	char *c, *cmd, *p, *q, *shell, *name, *tmpshell, *slashp;

 	debug = 0;
 	magic = '%';		/* Default magic char is `%'. */
@@ -109,13 +109,31 @@
 		}

 	/*
+	 * Figure out the shell and name arguments to pass to execl()
+	 * in exec_shell().  Always malloc() shell and just set name
+	 * to point at the last part of shell if there are any backslashes,
+	 * otherwise just set it to point at the space malloc()'d.  If
+	 * SHELL environment variable exists, replace contents of
+	 * shell with it.
+	 */
+	shell = name = NULL;
+	tmpshell = getenv("SHELL");
+	shell = (tmpshell != NULL) ? strdup(tmpshell) : strdup(_PATH_BSHELL);
+	if (shell == NULL)
+		err(1, "strdup() failed");
+	slashp = strrchr(shell, '/');
+	name = (slashp != NULL) ? slashp + 1 : shell;
+
+	/*
 	 * If there were any %digit references, then use those, otherwise
 	 * build a new command string with sufficient %digit references at
 	 * the end to consume (nargs) arguments each time round the loop.
-	 * Allocate enough space to hold the maximum command.
-	 */
-	if ((cmd = malloc(sizeof("exec ") - 1 +
-	    strlen(argv[0]) + 9 * (sizeof(" %1") - 1) + 1)) == NULL)
+	 * Allocate enough space to hold the maximum command.  Save the
+	 * size to pass to snprintf().
+	 */
+	cmdsize = sizeof(EXEC) - 1 + strlen(argv[0]) + 9 *
+		(sizeof(" %1") - 1) + 1;
+	if ((cmd = malloc(cmdsize)) == NULL)
 		err(1, NULL);

 	if (n == 0) {
@@ -124,9 +142,16 @@
 			nargs = 1;

 		p = cmd;
-		p += sprintf(cmd, "exec %s", argv[0]);
-		for (i = 1; i <= nargs; i++)
-			p += sprintf(p, " %c%d", magic, i);
+		offset = snprintf(cmd, cmdsize, EXEC "%s", argv[0]);
+		if ((size_t)offset >= cmdsize)
+			err(1, "snprintf() failed");
+		p += offset;
+		for (i = 1; i <= nargs; i++) {
+			offset = snprintf(p, cmdsize, " %c%d", magic, i);
+			if ((size_t)offset >= cmdsize)
+				err(1, "snprintf() failed");
+			p += offset;
+		}

 		/*
 		 * If nargs set to the special value 0, eat a single
@@ -135,7 +160,9 @@
 		if (nargs == 0)
 			nargs = 1;
 	} else {
-		(void)sprintf(cmd, "exec %s", argv[0]);
+		offset = snprintf(cmd, cmdsize, EXEC "%s", argv[0]);
+		if ((size_t)offset >= cmdsize)
+			err(1, "snprintf() failed");
 		nargs = n;
 	}

@@ -164,9 +191,13 @@

 		/* Expand command argv references. */
 		for (p = cmd, q = c; *p != '\0'; ++p)
-			if (p[0] == magic && isdigit(p[1]) && p[1] != '0')
-				q += sprintf(q, "%s", argv[(++p)[0] - '0']);
-			else
+			if (p[0] == magic && isdigit(p[1]) && p[1] != '0') {
+				offset = snprintf(q, l, "%s",
+				    argv[(++p)[0] - '0']);
+				if ((size_t)offset >= l)
+					err(1, "snprintf() failed");
+				q += offset;
+			} else
 				*q++ = *p;

 		/* Terminate the command string. */
@@ -176,38 +207,32 @@
 		if (debug)
 			(void)printf("%s\n", c);
 		else
-			if (system(c))
+			if (exec_shell(shell, name, c))
 				rval = 1;
 	}

 	if (argc != 1)
 		errx(1, "expecting additional argument%s after \"%s\"",
-		    (nargs - argc) ? "s" : "", argv[argc - 1]);
+	    (nargs - argc) ? "s" : "", argv[argc - 1]);
+
+	free(cmd);
+	free(c);
+	free(shell);
 	exit(rval);
 }

 /*
- * system --
- * 	Private version of system(3).  Use the user's SHELL environment
- *	variable as the shell to execute.
+ * exec_shell --
+ * 	Execute a shell command using passed use_shell and use_name
+ * 	arguments.
  */
-int
-system(command)
-	const char *command;
+static int
+exec_shell(char *use_shell, char *use_name, const char *command)
 {
-	static char *name, *shell;
 	pid_t pid;
 	int omask, pstat;
 	sig_t intsave, quitsave;

-	if (shell == NULL) {
-		if ((shell = getenv("SHELL")) == NULL)
-			shell = _PATH_BSHELL;
-		if ((name = strrchr(shell, '/')) == NULL)
-			name = shell;
-		else
-			++name;
-	}
 	if (!command)		/* just checking... */
 		return(1);

@@ -217,8 +242,8 @@
 		err(1, "vfork");
 	case 0:				/* child */
 		(void)sigsetmask(omask);
-		execl(shell, name, "-c", command, NULL);
-		warn("%s", shell);
+		execl(use_shell, use_name, "-c", command, NULL);
+		warn("%s", use_shell);
 		_exit(1);
 	}
 	intsave = signal(SIGINT, SIG_IGN);


* modules/video_output/x11/xcommon.c: before using an Xv port, make sure XV_AUTOPAINT_COLORKEY is switched on.

--- modules/video_output/x11/xcommon.c
+++ modules/video_output/x11/xcommon.c
@@ -1688,13 +1688,8 @@
              i_format < i_num_formats && ( i_selected_port == -1 );
              i_format++ )
         {
-            /* Code removed, we can get this through xvinfo anyway */
-#if 0
-            XvEncodingInfo  *p_enc;
-            int             i_enc, i_num_encodings;
             XvAttribute     *p_attr;
             int             i_attr, i_num_attributes;
-#endif

             /* If this is not the format we want, or at least a
              * similar one, forget it */
@@ -1731,50 +1726,28 @@
                      ( p_formats[ i_format ].format == XvPacked ) ?
                          "packed" : "planar" );

-#if 0
-            msg_Dbg( p_vout, " encoding list:" );
-
-            if( XvQueryEncodings( p_vout->p_sys->p_display, i_selected_port,
-                                  &i_num_encodings, &p_enc )
-                 != Success )
-            {
-                msg_Dbg( p_vout, "  XvQueryEncodings failed" );
-                continue;
-            }
-
-            for( i_enc = 0; i_enc < i_num_encodings; i_enc++ )
-            {
-                msg_Dbg( p_vout, "  id=%ld, name=%s, size=%ldx%ld,"
-                                      " numerator=%d, denominator=%d",
-                             p_enc[i_enc].encoding_id, p_enc[i_enc].name,
-                             p_enc[i_enc].width, p_enc[i_enc].height,
-                             p_enc[i_enc].rate.numerator,
-                             p_enc[i_enc].rate.denominator );
-            }
-
-            if( p_enc != NULL )
-            {
-                XvFreeEncodingInfo( p_enc );
-            }
-
-            msg_Dbg( p_vout, " attribute list:" );
+            /* Make sure XV_AUTOPAINT_COLORKEY is set */
             p_attr = XvQueryPortAttributes( p_vout->p_sys->p_display,
                                             i_selected_port,
                                             &i_num_attributes );
+
             for( i_attr = 0; i_attr < i_num_attributes; i_attr++ )
             {
-                msg_Dbg( p_vout, "  name=%s, flags=[%s%s ], min=%i, max=%i",
-                      p_attr[i_attr].name,
-                      (p_attr[i_attr].flags & XvGettable) ? " get" : "",
-                      (p_attr[i_attr].flags & XvSettable) ? " set" : "",
-                      p_attr[i_attr].min_value, p_attr[i_attr].max_value );
+                if( !strcmp( p_attr[i_attr].name, "XV_AUTOPAINT_COLORKEY" ) )
+                {
+                    const Atom autopaint =
+                        XInternAtom( p_vout->p_sys->p_display,
+                                     "XV_AUTOPAINT_COLORKEY", False );
+                    XvSetPortAttribute( p_vout->p_sys->p_display,
+                                        i_selected_port, autopaint, 1 );
+                    break;
+                }
             }

             if( p_attr != NULL )
             {
                 XFree( p_attr );
             }
-#endif
         }

         if( p_formats != NULL )


When login tries to do the chmod/chflags on a read only file system,
it complains that it can't do it because the filesystem is readonly.
Assume that when the user has a readonly /dev that they don't care if
login can't change the permissions/flags.  While this does break a few
things like msgs, we'll assume that the user setting up the read only
system knows what they are doing.

All this change does is to stop the complaint when the file system is
read only.  It also adds comments as to why EROFS and EOPNOTSUPP are
ignored.

This allows one to have a read-only / w/o a /dev MFS and have a
relatively warning-free existence.  /etc/rc still complains when it
can't chown/chflags/chmod things, but that's easy to ignore/tweak.

Reviewed by: roberto, phk
Sponsored by: Timing Solutions

--- usr.bin/login/login.c
+++ usr.bin/login/login.c
@@ -410,12 +410,21 @@
 	 * user sets them otherwise, this can cause the chown to fail.
 	 * Since it isn't clear that flags are useful on character
 	 * devices, we just clear them.
-	 */
-	if (ttyn != tname && chflags(ttyn, 0) && errno != EOPNOTSUPP)
-		syslog(LOG_ERR, "chflags(%s): %m", ttyn);
+	 *
+	 * We don't log in the case of EOPNOTSUPP because dev might be
+	 * on NFS, which doesn't support chflags.
+	 *
+	 * We don't log in the EROFS because that means that /dev is on
+	 * a read only file system and we assume that the permissions there
+	 * are sane.
+	 */
+	if (ttyn != tname && chflags(ttyn, 0))
+		if (errno != EOPNOTSUPP && errno != EROFS)
+			syslog(LOG_ERR, "chflags(%s): %m", ttyn);
 	if (ttyn != tname && chown(ttyn, pwd->pw_uid,
 	    (gr = getgrnam(TTYGRPNAME)) ? gr->gr_gid : pwd->pw_gid))
-		syslog(LOG_ERR, "chmod(%s): %m", ttyn);
+		if (errno != EROFS)
+			syslog(LOG_ERR, "chmod(%s): %m", ttyn);

 	/*
 	 * Exclude cons/vt/ptys only, assume dialup otherwise


progs/xdemos: Add missing break statement in offset.c.

--- progs/xdemos/offset.c
+++ progs/xdemos/offset.c
@@ -294,6 +294,7 @@
 	    default:
 		break;
 	    }
+	    break;
 	case ButtonPress:
 	    prevx = event.xbutton.x;
 	    prevy = event.xbutton.y;


More low hanging warnings fruit; ANSIfy, de-register, constify.

--- usr.bin/paste/paste.c
+++ usr.bin/paste/paste.c
@@ -50,6 +50,7 @@
 __FBSDID("$FreeBSD$");

 #include <sys/types.h>
+
 #include <err.h>
 #include <errno.h>
 #include <limits.h>
@@ -66,10 +67,10 @@
 int tr(char *);
 static void usage(void);

+char tab[] = "\t";
+
 int
-main(argc, argv)
-	int argc;
-	char **argv;
+main(int argc, char *argv[])
 {
 	int ch, seq;

@@ -93,7 +94,7 @@
 		usage();
 	if (!delim) {
 		delimcnt = 1;
-		delim = "\t";
+		delim = tab;
 	}

 	if (seq)
@@ -111,12 +112,11 @@
 } LIST;

 void
-parallel(argv)
-	char **argv;
-{
-	register LIST *lp;
-	register int cnt;
-	register char ch, *p;
+parallel(char **argv)
+{
+	LIST *lp;
+	int cnt;
+	char ch, *p;
 	LIST *head, *tmp;
 	int opencnt, output;
 	char buf[_POSIX2_LINE_MAX + 1];
@@ -178,12 +178,11 @@
 }

 void
-sequential(argv)
-	char **argv;
-{
-	register FILE *fp;
-	register int cnt;
-	register char ch, *p, *dp;
+sequential(char **argv)
+{
+	FILE *fp;
+	int cnt;
+	char ch, *p, *dp;
 	char buf[_POSIX2_LINE_MAX + 1];

 	for (; (p = *argv); ++argv) {
@@ -216,11 +215,10 @@
 }

 int
-tr(arg)
-	char *arg;
-{
-	register int cnt;
-	register char ch, *p;
+tr(char *arg)
+{
+	int cnt;
+	char ch, *p;

 	for (p = arg, cnt = 0; (ch = *p++); ++arg, ++cnt)
 		if (ch == '\\')
@@ -246,7 +244,7 @@
 }

 static void
-usage()
+usage(void)
 {
 	(void)fprintf(stderr, "usage: paste [-s] [-d delimiters] file ...\n");
 	exit(1);


Fix ttynames generation broken with strlcat

PR:		25541
Submitted by:	Nickolay Dudorov <nnd@mail.nsk.ru>

--- usr.bin/wall/ttymsg.c
+++ usr.bin/wall/ttymsg.c
@@ -71,7 +71,7 @@
 	if (iovcnt > sizeof(localiov) / sizeof(localiov[0]))
 		return ("too many iov's (change code in wall/ttymsg.c)");

-	strlcat(device, line, sizeof(device));
+	strlcpy(device + sizeof(_PATH_DEV) - 1, line, sizeof(device));
 	if (strchr(device + sizeof(_PATH_DEV) - 1, '/')) {
 		/* A slash is an attempt to break security... */
 		(void) snprintf(errbuf, sizeof(errbuf),


choose in priority the allocated ABI if any to do the ${ABI} substitution in PACKAGESITE

Reviewed by:	bdrewery

--- usr.sbin/pkg/config.c
+++ usr.sbin/pkg/config.c
@@ -376,7 +376,7 @@
 		c[ABI].val = abi;
 	}

-	subst_packagesite(c[ABI].val);
+	subst_packagesite(c[ABI].value != NULL ? c[ABI].value : c[ABI].val);

 	return (0);
 }


regen

regen

--- dev/pcmcia/pcmciadevs.h
+++ dev/pcmcia/pcmciadevs.h
@@ -1,4 +1,4 @@
-/*	$OpenBSD: pcmciadevs.h,v 1.58 2001/03/27 10:24:22 peter Exp $	*/
+/*	$OpenBSD: pcmciadevs.h,v 1.59 2001/03/29 01:36:24 aaron Exp $	*/

 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -498,6 +498,8 @@
 #define	PCMCIA_PRODUCT_TAMARACK_NE2000	PCMCIA_PRODUCT_INVALID
 #define	PCMCIA_CIS_SARAMNCOM_NS_1100M	{ "NANOSPEED", "HFA384x/IEEE", NULL, NULL }
 #define	PCMCIA_PRODUCT_SARAMNCOM_NS_1100M	PCMCIA_PRODUCT_INVALID
+#define	PCMCIA_CIS_NETGEAR_FA410TX	{ "NETGEAR", "FA410TX", "Fast Ethernet", NULL}
+#define	PCMCIA_PRODUCT_NETGEAR_FA410TX	PCMCIA_PRODUCT_INVALID
 #define	PCMCIA_CIS_COREGA_WIRELESS_LAN_PCCA_11	{ "corega K.K.", "Wireless LAN PCCA-11", NULL, NULL }
 #define	PCMCIA_PRODUCT_COREGA_WIRELESS_LAN_PCCA_11	PCMCIA_PRODUCT_INVALID
 #define	PCMCIA_CIS_INTERSIL_PRISM2	{ "INTERSIL", "HFA384x/IEEE", "Version 01.02", NULL }


Fix other comments RZAutoImport -> RZImport

--- Extensions/NSManagedObject+RZImport.h
+++ Extensions/NSManagedObject+RZImport.h
@@ -108,7 +108,7 @@
  *  @param context The context in which to find/insert the object. Must not be nil.
  *  @param mappings An optional dictionary of extra mappings from keys to property names to
  *                  use in the import. These will override/supplement implicit mappings and mappings
- *                  provided by @p RZAutoImportable.
+ *                  provided by @p RZImportable.
  *
  *  @note Calling @p rzi_objectsFromArray: without the context parameter will use the default context provided by
  *        calling @p +rzv_coreDataStack on the managed object subclass.
@@ -124,7 +124,7 @@

 /**
- *  Extended implementation of the method from @p RZAutoImportable.
+ *  Extended implementation of the method from @p RZImportable.
  *  Do not call directly; this is exposed for reasons of documentation only.
  *
  *  If you override this method in an @p NSManagedObject subclass, it must always return a valid instance
@@ -133,7 +133,7 @@
  *  @param dict The dictionary representing an instance of the receiver's class.
  *  @param context The managed object context in which to find/insert the object.
  *
- *  @warning Do not implement the @p RZAutoImportable protocol method @p +rzi_existingObjectForDict: in subclasses.
+ *  @warning Do not implement the @p RZImportable protocol method @p +rzi_existingObjectForDict: in subclasses.
  *           This method is called by an internal implementation of @p +rzi_existingObjectForDict: which will pass along the correct
  *           context based on a bit of internal state.
  *
@@ -143,7 +143,7 @@
 + (id)rzi_existingObjectForDict:(NSDictionary *)dict inContext:(NSManagedObjectContext *)context;

 /**
- *  Extended implementation of the method from @p RZAutoImportable.
+ *  Extended implementation of the method from @p RZImportable.
  *  Do not call directly; this is exposed for reasons of documentation only.
  *
  *  If you override this method in an @p NSManagedObject subclass for purposes of validation, you must only prevent
@@ -154,7 +154,7 @@
  *  @param key     The key being imported.
  *  @param context The context in which the import is taking place.
  *
- *  @warning Do not implement the @p RZAutoImportable protocol method @p +rzi_shouldImportValue:forKey: in subclasses.
+ *  @warning Do not implement the @p RZImportable protocol method @p +rzi_shouldImportValue:forKey: in subclasses.
  *           This method is called by an internal implementation of @p +rzi_shouldImportValue:forKey: which will pass along the correct
  *           context based on a bit of internal state.
  *


regen

regen

--- dev/pcmcia/pcmciadevs.h
+++ dev/pcmcia/pcmciadevs.h
@@ -1,10 +1,10 @@
-/*	$OpenBSD: pcmciadevs.h,v 1.85 2002/03/28 16:46:32 provos Exp $	*/
+/*	$OpenBSD: pcmciadevs.h,v 1.86 2002/03/29 18:54:45 millert Exp $	*/

 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *		OpenBSD: pcmciadevs,v 1.84 2002/03/28 16:45:52 provos Exp
+ *		OpenBSD: pcmciadevs,v 1.85 2002/03/29 18:54:07 millert Exp
  */
 /* $NetBSD: pcmciadevs,v 1.13 1998/08/17 23:10:12 thorpej Exp $ */

@@ -366,6 +366,8 @@
 #define	PCMCIA_PRODUCT_PROXIM_ROAMABOUT_2400FH	0x1058
 #define	PCMCIA_CIS_PROXIM_RANGELAN2_7401	{ NULL, NULL, NULL, NULL }
 #define	PCMCIA_PRODUCT_PROXIM_RANGELAN2_7401	0x1158
+#define	PCMCIA_CIS_PROXIM_RANGELANDS_8430	{ NULL, NULL, NULL, NULL }
+#define	PCMCIA_PRODUCT_PROXIM_RANGELANDS_8430	0x8000

 /* Ericsson */
 #define	PCMCIA_CIS_ERICSSON_WIRELESSLAN	{ NULL, NULL, NULL, NULL }


Fixup for type change.

Fixup for type change.

git-svn-id: e875384d7a5ebd9b2def38a8354dae1fda8e73bc@4001 be551aaa-1e26-0410-a405-d3ace91eadb9

--- testcode/checklocks.c
+++ testcode/checklocks.c
@@ -61,7 +61,7 @@
 /** if the key was deleted, i.e. we have quit */
 static int key_deleted = 0;
 /** we hide the thread debug info with this key. */
-static ub_thread_key_t thr_debug_key;
+static ub_thread_key_type thr_debug_key;
 /** the list of threads, so all threads can be examined. NULL if unused. */
 static struct thr_check* thread_infos[THRDEBUG_MAX_THREADS];
 /** do we check locking order */


regen

regen

--- dev/pcmcia/pcmciadevs.h
+++ dev/pcmcia/pcmciadevs.h
@@ -1,10 +1,10 @@
-/*	$OpenBSD: pcmciadevs.h,v 1.76 2001/10/28 19:21:58 mickey Exp $	*/
+/*	$OpenBSD: pcmciadevs.h,v 1.77 2001/11/06 21:54:14 mickey Exp $	*/

 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *		OpenBSD: pcmciadevs,v 1.71 2001/10/28 19:21:37 mickey Exp
+ *		OpenBSD: pcmciadevs,v 1.73 2001/11/06 21:52:26 mickey Exp
  */
 /* $NetBSD: pcmciadevs,v 1.13 1998/08/17 23:10:12 thorpej Exp $ */

@@ -550,6 +550,8 @@
 #define	PCMCIA_PRODUCT_ZOOM_AIR4000	PCMCIA_PRODUCT_INVALID
 #define	PCMCIA_CIS_TAMARACK_NE2000	{ "TAMARACK", "Ethernet", NULL, NULL }
 #define	PCMCIA_PRODUCT_TAMARACK_NE2000	PCMCIA_PRODUCT_INVALID
+#define	PCMCIA_CIS_LINKSYS_PCM100	{ "Linksys", "EtherFast 10/100 Integrated PC Card (PCM100)", "Ver 1.0", NULL }
+#define	PCMCIA_PRODUCT_LINKSYS_PCM100	PCMCIA_PRODUCT_INVALID
 #define	PCMCIA_CIS_SARAMNCOM_NS_1100M	{ "NANOSPEED", "HFA384x/IEEE", NULL, NULL }
 #define	PCMCIA_PRODUCT_SARAMNCOM_NS_1100M	PCMCIA_PRODUCT_INVALID
 #define	PCMCIA_CIS_INTERSIL_PRISM2	{ "INTERSIL", "HFA384x/IEEE", "Version 01.02", NULL }


expect that read() might return less data than we asked for.

--- src/network_gthread_aio.c
+++ src/network_gthread_aio.c
@@ -82,7 +82,7 @@
 				max_toSend : c->file.length - c->offset;

 			c->file.copy.offset = 0;
-			c->file.copy.length = toSend;
+			c->file.copy.length = 0;

 			/* open a file in /dev/shm to write to */
 			if (c->file.mmap.start == MAP_FAILED) {
@@ -96,7 +96,7 @@
 					}
 				} else {
 					c->file.mmap.offset = 0;
-					c->file.mmap.length = c->file.copy.length; /* align to page-size */
+					c->file.mmap.length = toSend;

 					c->file.mmap.start = mmap(0, c->file.mmap.length,
 							PROT_READ | PROT_WRITE, MAP_SHARED, mmap_fd, 0);
@@ -110,9 +110,7 @@
 			}

 			if (c->file.mmap.start != MAP_FAILED) {
-				lseek(c->file.fd, c->file.start + c->offset, SEEK_SET);
-
-				if (-1 == (r = read(c->file.fd, c->file.mmap.start, c->file.copy.length))) {
+				if (-1 == (r = pread(c->file.fd, c->file.mmap.start, toSend, c->file.start + c->offset))) {
 					switch(errno) {
 					default:
 						ERROR("reading file failed: %d (%s)", errno, strerror(errno));
@@ -120,13 +118,11 @@
 						c->async.ret_val = NETWORK_STATUS_FATAL_ERROR;
 					}
 				} else if (r == 0) {
-					ERROR("read() returned 0 ... not good: %s", "");
+					ERROR("pread(%s) returned 0 ... not good", BUF_STR(c->file.name));

 					c->async.ret_val = NETWORK_STATUS_FATAL_ERROR;
-				} else if (r != c->file.copy.length) {
-					ERROR("read() returned %d instead of %d", r, c->file.copy.length);
-
-					c->async.ret_val = NETWORK_STATUS_FATAL_ERROR;
+				} else {
+					c->file.copy.length = r;
 				}
 			}


use LIRC_MODE_LIRCCODE

use LIRC_MODE_LIRCCODE


Fix gridding bounds check

Fix gridding bounds check

Logic was plain wrong. Also it doesn't really matter whether we degrid
a visibility direct or conjugated if we have both options - so go for
the normal option by default.

--- examples/grid/streamer.c
+++ examples/grid/streamer.c
@@ -263,7 +263,7 @@
     double complex *vis_data = (double complex *) alloca(vis_data_size);
     memset(vis_data, 0, vis_data_size);

-    // Do degridding. Twice if necessary.
+    // Do degridding
     double start = get_time_ns();
     uint64_t flops = 0;
     int time, freq;
@@ -273,21 +273,27 @@
             // Bounds check
             double u = uvw_lambda(bl_data, time, freq, 0);
             double v = uvw_lambda(bl_data, time, freq, 1);
-            if ((u >= fmax(0, sg_min_u) || u < sg_max_u) &&
-                (v >= sg_min_v || v < sg_max_v)) {
-
+            bool inv = false;
+            if (u >= sg_min_u && u < sg_max_u &&
+                v >= sg_min_v && v < sg_max_v) {
+
+                // Degrid normal
                 vis_data[(time-it0)*spec->freq_chunk + freq-if0] =
                     degrid_conv_uv(subgrid, cfg->xM_size, theta,
                                    u-sg_mid_u, v-sg_mid_v, &streamer->kern, &flops);

-            } else if ((-u >= fmax(0, sg_min_u) || -u < sg_max_u) &&
-                       (-v >= sg_min_v || -v < sg_max_v)) {
-
+            } else if (-u >= sg_min_u && -u < sg_max_u &&
+                       -v >= sg_min_v && -v < sg_max_v) {
+
+                // Degrid conjugate at negative coordinate
+                inv = true;
                 vis_data[(time-it0)*spec->freq_chunk + freq-if0] =
                     conj(degrid_conv_uv(subgrid, cfg->xM_size, theta,
                                         -u-sg_mid_u, -v-sg_mid_v, &streamer->kern, &flops)
                          );

+            } else {
+                continue;
             }

         }