mirror of
https://github.com/HeyPuter/gex.git
synced 2026-11-13 20:12:43 -10:00
tests/x86-programs/smc-race: 8-byte-aligned type for the i386 atomic stores (no -Watomic-alignment)
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_461fe3ff06374ecba693831148697ba6
This commit is contained in:
1 parent
e12da4605b
commit
d4da17b827
1 file changed
+3
-2
@@ -29,7 +29,8 @@ static void spin(long us) {
|
||||
#define CHURN 20
|
||||
#endif
|
||||
|
||||
static volatile uint64_t *fn;
|
||||
typedef uint64_t __attribute__((aligned(8))) u64a; /* i386: 8-byte atomic stores */
|
||||
static volatile u64a *fn;
|
||||
static atomic_int round_no, done_writing;
|
||||
|
||||
static uint64_t code_for(int n) {
|
||||
@@ -60,7 +61,7 @@ static void *writer(void *arg) {
|
||||
int main(void) {
|
||||
unsigned char *page = mmap(0, 0x1000, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
if (page == MAP_FAILED) return 2;
|
||||
fn = (volatile uint64_t *)(page + 0x100);
|
||||
fn = (volatile u64a *)(page + 0x100);
|
||||
*fn = code_for(0);
|
||||
pthread_t w;
|
||||
pthread_create(&w, 0, writer, 0);
|
||||
|
||||
Reference in new issue
Block a user