18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci *
38c2ecf20Sopenharmony_ci * include/asm-sh/flat.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * uClinux flat-format executables
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 2003  Paul Mundt
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci#ifndef __ASM_SH_FLAT_H
108c2ecf20Sopenharmony_ci#define __ASM_SH_FLAT_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <asm/unaligned.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cistatic inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
158c2ecf20Sopenharmony_ci					u32 *addr)
168c2ecf20Sopenharmony_ci{
178c2ecf20Sopenharmony_ci	*addr = get_unaligned((__force u32 *)rp);
188c2ecf20Sopenharmony_ci	return 0;
198c2ecf20Sopenharmony_ci}
208c2ecf20Sopenharmony_cistatic inline int flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 rel)
218c2ecf20Sopenharmony_ci{
228c2ecf20Sopenharmony_ci	put_unaligned(addr, (__force u32 *)rp);
238c2ecf20Sopenharmony_ci	return 0;
248c2ecf20Sopenharmony_ci}
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#define FLAT_PLAT_INIT(_r) \
278c2ecf20Sopenharmony_ci  do { _r->regs[0]=0; _r->regs[1]=0; _r->regs[2]=0; _r->regs[3]=0; \
288c2ecf20Sopenharmony_ci       _r->regs[4]=0; _r->regs[5]=0; _r->regs[6]=0; _r->regs[7]=0; \
298c2ecf20Sopenharmony_ci       _r->regs[8]=0; _r->regs[9]=0; _r->regs[10]=0; _r->regs[11]=0; \
308c2ecf20Sopenharmony_ci       _r->regs[12]=0; _r->regs[13]=0; _r->regs[14]=0; \
318c2ecf20Sopenharmony_ci       _r->sr = SR_FD; } while (0)
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#endif /* __ASM_SH_FLAT_H */
34