File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -311,8 +311,10 @@ static void mmu_load(vm_t *vm,
311
311
if (vm -> error )
312
312
return ;
313
313
314
- if (unlikely (reserved ))
314
+ if (unlikely (reserved )) {
315
315
vm -> lr_reservation = addr | 1 ;
316
+ vm -> lr_val = * value ;
317
+ }
316
318
}
317
319
318
320
static bool mmu_store (vm_t * vm ,
@@ -328,8 +330,11 @@ static bool mmu_store(vm_t *vm,
328
330
return false;
329
331
330
332
if (unlikely (cond )) {
331
- if (vm -> lr_reservation != (addr | 1 ))
333
+ uint32_t cas_value ;
334
+ vm -> mem_load (vm , addr , width , & cas_value );
335
+ if ((vm -> lr_reservation != (addr | 1 )) || vm -> lr_val != cas_value )
332
336
return false;
337
+
333
338
vm -> lr_reservation = 0 ;
334
339
} else {
335
340
if (unlikely (vm -> lr_reservation & 1 ) &&
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ struct __vm_internal {
56
56
57
57
/* LR reservation virtual address. last bit is 1 if valid */
58
58
uint32_t lr_reservation ;
59
+ uint32_t lr_val ;
59
60
60
61
/* Assumed to contain an aligned address at all times */
61
62
uint32_t pc ;
You can’t perform that action at this time.
0 commit comments