18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef  __MOVS_H__
38c2ecf20Sopenharmony_ci#define __MOVS_H__
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/*
68c2ecf20Sopenharmony_ci** movs.h
78c2ecf20Sopenharmony_ci**
88c2ecf20Sopenharmony_ci** Inline assembly macros to generate movs & related instructions
98c2ecf20Sopenharmony_ci*/
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/* Set DFC register value */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define SET_DFC(x) \
148c2ecf20Sopenharmony_ci        __asm__ __volatile__ (" movec %0,%/dfc" : : "d" (x));
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/* Get DFC register value */
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define GET_DFC(x) \
198c2ecf20Sopenharmony_ci        __asm__ __volatile__ (" movec %/dfc, %0" : "=d" (x) : );
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* Set SFC register value */
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#define SET_SFC(x) \
248c2ecf20Sopenharmony_ci        __asm__ __volatile__ (" movec %0,%/sfc" : : "d" (x));
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* Get SFC register value */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define GET_SFC(x) \
298c2ecf20Sopenharmony_ci        __asm__ __volatile__ (" movec %/sfc, %0" : "=d" (x) : );
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define SET_VBR(x) \
328c2ecf20Sopenharmony_ci        __asm__ __volatile__ (" movec %0,%/vbr" : : "r" (x));
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define GET_VBR(x) \
358c2ecf20Sopenharmony_ci        __asm__ __volatile__ (" movec %/vbr, %0" : "=g" (x) : );
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/* Set a byte using the "movs" instruction */
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#define SET_CONTROL_BYTE(addr,value) \
408c2ecf20Sopenharmony_ci        __asm__ __volatile__ (" movsb %0, %1@" : : "d" (value), "a" (addr));
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/* Get a byte using the "movs" instruction */
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#define GET_CONTROL_BYTE(addr,value) \
458c2ecf20Sopenharmony_ci        __asm__ __volatile__ (" movsb %1@, %0" : "=d" (value) : "a" (addr));
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* Set a (long)word using the "movs" instruction */
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#define SET_CONTROL_WORD(addr,value) \
508c2ecf20Sopenharmony_ci        __asm__ __volatile__ (" movsl %0, %1@" : : "d" (value), "a" (addr));
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/* Get a (long)word using the "movs" instruction */
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define GET_CONTROL_WORD(addr,value) \
558c2ecf20Sopenharmony_ci        __asm__ __volatile__ (" movsl %1@, %0" : "=d" (value) : "a" (addr));
568c2ecf20Sopenharmony_ci#endif
57