Print this page
5042 stop using deprecated atomic functions

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/sun4/os/machdep.c
          +++ new/usr/src/uts/sun4/os/machdep.c
↓ open down ↓ 542 lines elided ↑ open up ↑
 543  543           * return to, swtch() gets called and we end up here.
 544  544           *
 545  545           * It can also happen if an interrupt thread in intr_thread() calls
 546  546           * preempt. It will have already taken care of updating stats. In
 547  547           * this event, the interrupt thread will be runnable.
 548  548           */
 549  549          if (t->t_intr_start) {
 550  550                  do {
 551  551                          start = t->t_intr_start;
 552  552                          interval = CLOCK_TICK_COUNTER() - start;
 553      -                } while (cas64(&t->t_intr_start, start, 0) != start);
      553 +                } while (atomic_cas_64(&t->t_intr_start, start, 0) != start);
 554  554                  cpu = CPU;
 555  555                  if (cpu->cpu_m.divisor > 1)
 556  556                          interval *= cpu->cpu_m.divisor;
 557  557                  cpu->cpu_m.intrstat[t->t_pil][0] += interval;
 558  558  
 559  559                  atomic_add_64((uint64_t *)&cpu->cpu_intracct[cpu->cpu_mstate],
 560  560                      interval);
 561  561          } else
 562  562                  ASSERT(t->t_intr == NULL || t->t_state == TS_RUN);
 563  563  }
↓ open down ↓ 6 lines elided ↑ open up ↑
 570  570  void
 571  571  cpu_intr_swtch_exit(kthread_id_t t)
 572  572  {
 573  573          uint64_t ts;
 574  574  
 575  575          ASSERT((t->t_flag & T_INTR_THREAD) != 0);
 576  576          ASSERT(t->t_pil > 0 && t->t_pil <= LOCK_LEVEL);
 577  577  
 578  578          do {
 579  579                  ts = t->t_intr_start;
 580      -        } while (cas64(&t->t_intr_start, ts, CLOCK_TICK_COUNTER()) != ts);
      580 +        } while (atomic_cas_64(&t->t_intr_start, ts, CLOCK_TICK_COUNTER()) !=
      581 +            ts);
 581  582  }
 582  583  
 583  584  
 584  585  int
 585  586  blacklist(int cmd, const char *scheme, nvlist_t *fmri, const char *class)
 586  587  {
 587  588          if (&plat_blacklist)
 588  589                  return (plat_blacklist(cmd, scheme, fmri, class));
 589  590  
 590  591          return (ENOTSUP);
↓ open down ↓ 304 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX