Subject: [nathanw_sa] Incorrect handling of _UC_USER in alpha SETC() macro?
To: None <>
From: Jason R Thorpe <>
List: tech-userlevel
Date: 01/05/2003 17:56:27
The SETC() macro (used in _setcontext_u() in libpthread) looks like
this on alpha:

#define SETC(reg)                                       ; \
        ldl     t0, (UC_FLAGS)(reg)                     ; \
        ldiq    t1, 1                                   ; \
        sll     t1, _UC_USER_BIT, t1                    ; \
        and     t0, t1, t0                              ; \
        beq     t0, 1f                                  ; \


	t0 = uc->uc_flags;
	t1 = (1 << _UC_USER_BIT);
	t0 = t0 & t1;

The "beq" insn on Alpha branches if the source operand is 0.  So, if I
am reading this right, it branches to the non-_UC_USER case if _UC_USER
is set, and falls through to the _UC_USER case for non-_UC_USER contexts.

I.e. the handling is exactly backwards.

Now, I have caught a cold, and am a little out of it today, so I could
appreciate a sanity check to make sure I'm not just being delusional.

        -- Jason R. Thorpe <>