Print this page
5042 stop using deprecated atomic functions

@@ -81,11 +81,11 @@
         }
 
         mnode = PFN_2_MEM_NODE(start);
         ASSERT(mnode < max_mem_nodes);
 
-        if (cas32((uint32_t *)&mem_node_config[mnode].exists, 0, 1)) {
+        if (atomic_cas_32((uint32_t *)&mem_node_config[mnode].exists, 0, 1)) {
                 /*
                  * Add slice to existing node.
                  */
                 if (start < mem_node_config[mnode].physbase)
                         mem_node_config[mnode].physbase = start;

@@ -96,11 +96,12 @@
                 mem_node_config[mnode].physmax = end;
                 atomic_add_16(&num_memnodes, 1);
                 do {
                         oldmask = memnodes_mask;
                         newmask = memnodes_mask | (1ull << mnode);
-                } while (cas64(&memnodes_mask, oldmask, newmask) != oldmask);
+                } while (atomic_cas_64(&memnodes_mask, oldmask, newmask) !=
+                         oldmask);
         }
         /*
          * Let the common lgrp framework know about the new memory
          */
         lgrp_config(LGRP_CONFIG_MEM_ADD, mnode, MEM_NODE_2_LGRPHAND(mnode));

@@ -156,11 +157,11 @@
                  */
                 ASSERT(MNODE_PGCNT(mnode) == 0);
                 do {
                         omask = memnodes_mask;
                         nmask = omask & ~(1ull << mnode);
-                } while (cas64(&memnodes_mask, omask, nmask) != omask);
+                } while (atomic_cas_64(&memnodes_mask, omask, nmask) != omask);
                 atomic_add_16(&num_memnodes, -1);
                 mem_node_config[mnode].exists = 0;
         }
 }
 

@@ -218,11 +219,11 @@
         /*
          * Find an unused memnode.  Update it atomically to prevent
          * a first time memnode creation race.
          */
         for (mnode = 0; mnode < max_mem_nodes; mnode++)
-                if (cas32((uint32_t *)&mem_node_config[mnode].exists,
+                if (atomic_cas_32((uint32_t *)&mem_node_config[mnode].exists,
                     0, 1) == 0)
                         break;
 
         if (mnode >= max_mem_nodes)
                         panic("Out of free memnodes\n");

@@ -231,11 +232,11 @@
         mem_node_config[mnode].physmax = 0;
         atomic_add_16(&num_memnodes, 1);
         do {
                 oldmask = memnodes_mask;
                 newmask = memnodes_mask | (1ull << mnode);
-        } while (cas64(&memnodes_mask, oldmask, newmask) != oldmask);
+        } while (atomic_cas_64(&memnodes_mask, oldmask, newmask) != oldmask);
 
         return (mnode);
 }
 
 /*