blob: 0e7102c3fb117e2f6ebdef2bad277e5ec2c27eec [file] [log] [blame]
Michal Simek4b87d7a2009-03-27 14:25:30 +01001/*
Michal Simek52338062009-05-26 16:30:18 +02002 * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
3 * Copyright (C) 2008-2009 PetaLogix
Michal Simek4b87d7a2009-03-27 14:25:30 +01004 * Copyright (C) 2006 Atmark Techno, Inc.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef _ASM_MICROBLAZE_SEGMENT_H
12#define _ASM_MICROBLAZE_SEGMENT_H
13
Michal Simek52338062009-05-26 16:30:18 +020014# ifndef __ASSEMBLY__
Michal Simek4b87d7a2009-03-27 14:25:30 +010015
16typedef struct {
17 unsigned long seg;
18} mm_segment_t;
19
20/*
21 * On Microblaze the fs value is actually the top of the corresponding
22 * address space.
23 *
24 * The fs value determines whether argument validity checking should be
25 * performed or not. If get_fs() == USER_DS, checking is performed, with
26 * get_fs() == KERNEL_DS, checking is bypassed.
27 *
28 * For historical reasons, these macros are grossly misnamed.
29 *
30 * For non-MMU arch like Microblaze, KERNEL_DS and USER_DS is equal.
31 */
Michal Simek52338062009-05-26 16:30:18 +020032# define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
33
34# ifndef CONFIG_MMU
35# define KERNEL_DS MAKE_MM_SEG(0)
Michal Simek4b87d7a2009-03-27 14:25:30 +010036# define USER_DS KERNEL_DS
Michal Simek52338062009-05-26 16:30:18 +020037# else
38# define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
39# define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
40# endif
Michal Simek4b87d7a2009-03-27 14:25:30 +010041
42# define get_ds() (KERNEL_DS)
43# define get_fs() (current_thread_info()->addr_limit)
Michal Simek52338062009-05-26 16:30:18 +020044# define set_fs(val) (current_thread_info()->addr_limit = (val))
Michal Simek4b87d7a2009-03-27 14:25:30 +010045
Michal Simek52338062009-05-26 16:30:18 +020046# define segment_eq(a, b) ((a).seg == (b).seg)
Michal Simek4b87d7a2009-03-27 14:25:30 +010047
48# endif /* __ASSEMBLY__ */
49#endif /* _ASM_MICROBLAZE_SEGMENT_H */