| 1 | /* |
| 2 | * arch/ubicom32/include/asm/segment.h |
| 3 | * Memory segment definitions for Ubicom32 architecture. |
| 4 | * |
| 5 | * (C) Copyright 2009, Ubicom, Inc. |
| 6 | * |
| 7 | * This file is part of the Ubicom32 Linux Kernel Port. |
| 8 | * |
| 9 | * The Ubicom32 Linux Kernel Port is free software: you can redistribute |
| 10 | * it and/or modify it under the terms of the GNU General Public License |
| 11 | * as published by the Free Software Foundation, either version 2 of the |
| 12 | * License, or (at your option) any later version. |
| 13 | * |
| 14 | * The Ubicom32 Linux Kernel Port is distributed in the hope that it |
| 15 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
| 16 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| 17 | * the GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with the Ubicom32 Linux Kernel Port. If not, |
| 21 | * see <http://www.gnu.org/licenses/>. |
| 22 | * |
| 23 | * Ubicom32 implementation derived from (with many thanks): |
| 24 | * arch/m68knommu |
| 25 | * arch/blackfin |
| 26 | * arch/parisc |
| 27 | */ |
| 28 | #ifndef _ASM_UBICOM32_SEGMENT_H |
| 29 | #define _ASM_UBICOM32_SEGMENT_H |
| 30 | |
| 31 | /* define constants */ |
| 32 | /* Address spaces (FC0-FC2) */ |
| 33 | #define USER_DATA (1) |
| 34 | #ifndef __USER_DS |
| 35 | #define __USER_DS (USER_DATA) |
| 36 | #endif |
| 37 | #define USER_PROGRAM (2) |
| 38 | #define SUPER_DATA (5) |
| 39 | #ifndef __KERNEL_DS |
| 40 | #define __KERNEL_DS (SUPER_DATA) |
| 41 | #endif |
| 42 | #define SUPER_PROGRAM (6) |
| 43 | #define CPU_SPACE (7) |
| 44 | |
| 45 | #ifndef __ASSEMBLY__ |
| 46 | |
| 47 | typedef struct { |
| 48 | unsigned long seg; |
| 49 | } mm_segment_t; |
| 50 | |
| 51 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) |
| 52 | #define USER_DS MAKE_MM_SEG(__USER_DS) |
| 53 | #define KERNEL_DS MAKE_MM_SEG(__KERNEL_DS) |
| 54 | |
| 55 | /* |
| 56 | * Get/set the SFC/DFC registers for MOVES instructions |
| 57 | */ |
| 58 | |
| 59 | static inline mm_segment_t get_fs(void) |
| 60 | { |
| 61 | return USER_DS; |
| 62 | } |
| 63 | |
| 64 | static inline mm_segment_t get_ds(void) |
| 65 | { |
| 66 | /* return the supervisor data space code */ |
| 67 | return KERNEL_DS; |
| 68 | } |
| 69 | |
| 70 | static inline void set_fs(mm_segment_t val) |
| 71 | { |
| 72 | } |
| 73 | |
| 74 | #define segment_eq(a,b) ((a).seg == (b).seg) |
| 75 | |
| 76 | #endif /* __ASSEMBLY__ */ |
| 77 | |
| 78 | #endif /* _ASM_UBICOM32_SEGMENT_H */ |
| 79 | |