Dec 03, 2020
04:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 03, 2020
04:15 AM
hi everyone.
i want to use "store" instruction using __asm__
Here are some codes.
unsigned int AddrVal =0x70000010;
unsigned int DataVal = 0x5;
__asm__("st.w 0x70000010," :: "d" (DataVal));
I want to store DataVal(5) to AddrVal but not using number 0x70000010.
How can i change it to variable?
__asm__("st.w AddrVal(?)," :: "d" (DataVal));
Thank you for reading.
i want to use "store" instruction using __asm__
Here are some codes.
unsigned int AddrVal =0x70000010;
unsigned int DataVal = 0x5;
__asm__("st.w 0x70000010," :: "d" (DataVal));
I want to store DataVal(5) to AddrVal but not using number 0x70000010.
How can i change it to variable?
__asm__("st.w AddrVal(?)," :: "d" (DataVal));
Thank you for reading.
3 Replies
Dec 03, 2020
08:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 03, 2020
08:57 AM
Please check this:
__asm__("st.w [%0],%1," ::"a" (AddrVal), "d" (DataVal));
__asm__("st.w [%0],%1," ::"a" (AddrVal), "d" (DataVal));
Jan 13, 2021
02:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 13, 2021
02:44 AM
Thanks, Now I have a problem with something else.
I want to write data to A11(Return Address) and i don't know how to using asm grammar.
I tried below already but it doesn't work.
unsigned int curr_pc = 0x1;
__asm__("mov.a a11,%1" :"a11" :: "d" (curr_pc));
Thank you for reading.
I want to write data to A11(Return Address) and i don't know how to using asm grammar.
I tried below already but it doesn't work.
unsigned int curr_pc = 0x1;
__asm__("mov.a a11,%1" :"a11" :: "d" (curr_pc));
Thank you for reading.
Jan 28, 2021
12:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 28, 2021
12:19 PM
You must use %0 instead of %1 in your case. Please note the 0x1 is not a valid value for PC.