Michal Simek | 4b87d7a | 2009-03-27 14:25:30 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 Michal Simek |
| 3 | * Copyright (C) 2008 PetaLogix |
| 4 | * 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 | |
| 14 | #ifndef __ASSEMBLY__ |
| 15 | |
| 16 | typedef 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 | */ |
| 32 | # define KERNEL_DS ((mm_segment_t){0}) |
| 33 | # define USER_DS KERNEL_DS |
| 34 | |
| 35 | # define get_ds() (KERNEL_DS) |
| 36 | # define get_fs() (current_thread_info()->addr_limit) |
| 37 | # define set_fs(x) \ |
| 38 | do { current_thread_info()->addr_limit = (x); } while (0) |
| 39 | |
| 40 | # define segment_eq(a, b) ((a).seg == (b).seg) |
| 41 | |
| 42 | # endif /* __ASSEMBLY__ */ |
| 43 | #endif /* _ASM_MICROBLAZE_SEGMENT_H */ |