棋子 · 2020年02月10日

How to test atomic access implementedvv

Hi there,

i have several inline assembly functions wrapped in C.

They implement atomic / read-modfy-write style

Compare And Swap
Increment
Decrement
Lock Semaphore
Creating a good case Test i got done.

But now i am struggling to produce a reliable and reproducible bad case test. I want to test the "exclusive store failed" paths in all functions.

Is there any way i can induce a Fail to the exclusive store upon the exclusive load?

Testing by Debugger to manually manipulate the Program Counter could be a way, but I prefer to

Id prefer to manipulate something in Memory to have a "minimal" effect...

My initial Tests to first:

simply halt execution between load and store exclusive,

then:

accessing RAM via debugger,

did not result in a failing Store Exclusive....

Is there some approach to this?

My Plan-B is to Brute Force it, by repeatedly calling the functions and trying to generate a lot IRQs to interrupt in the critical moment.

But that seems hardly reliable and reproducible....

1 个回答 得票排序 · 时间排序
极术小姐姐 · 2020年02月10日

If you can instrument your code, you might add a "WFI" before "STREX" and thn use an interrupt. Or use "CLREX"

你的回答
关注数
1
收藏数
0
浏览数
2308
极术小姐姐
极术微信服务号
关注极术微信号
实时接收点赞提醒和评论通知
安谋科技学堂公众号
关注安谋科技学堂
实时获取安谋科技及 Arm 教学资源
安谋科技招聘公众号
关注安谋科技招聘
实时获取安谋科技中国职位信息