18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef __ASM_CSKY_SEGMENT_H
58c2ecf20Sopenharmony_ci#define __ASM_CSKY_SEGMENT_H
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_citypedef struct {
88c2ecf20Sopenharmony_ci	unsigned long seg;
98c2ecf20Sopenharmony_ci} mm_segment_t;
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define KERNEL_DS		((mm_segment_t) { 0xFFFFFFFF })
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define USER_DS			((mm_segment_t) { 0x80000000UL })
148c2ecf20Sopenharmony_ci#define get_fs()		(current_thread_info()->addr_limit)
158c2ecf20Sopenharmony_ci#define set_fs(x)		(current_thread_info()->addr_limit = (x))
168c2ecf20Sopenharmony_ci#define uaccess_kernel()	(get_fs().seg == KERNEL_DS.seg)
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#endif /* __ASM_CSKY_SEGMENT_H */
19