Re: [RFC PATCH 1/4] hazptr: Add initial implementation of hazard pointers

From: Mathieu Desnoyers
Date: Wed Sep 25 2024 - 10:26:49 EST


On 2024-09-25 14:47, Mathieu Desnoyers wrote:
[...]

Like so:

#include <stdio.h>

#define __str_1(x)  #x
#define __str(x)    __str_1(x)

/* x86-64 */
#define bne_ptr(_a, _b, _label) \
    asm goto ( \
        "cmpq %[a], %[b]\n\t" \
        "jne %l[" __str(_label) "]\n\t" \
        : : [a] "r" (_a), [b] "r" (_b) \
        : : _label)

int x;

int v[2];

int main(void)
{
    bne_ptr(v, v + 1, label_same);
    x = 1;
label_same:

Note that this label should probably be called "label_ne".
I flipped the macro logic without changing the labels.

Thanks,

Mathieu

    printf("%d\n", x);
    return 0;
}



Regards,
Boqun

Thanks,

Mathieu

Regards,
Boqun


Have fun,
     jonas


--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com



--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com