|
[ source navigation ] [ diff markup ] [ identifier search ] [ general search ] |
|||
|
001 /* Copyright (C) 2004 The SOS Team 001 /* Copyright (C) 2004 The SOS Team 002 002 003 This program is free software; you can redi 003 This program is free software; you can redistribute it and/or 004 modify it under the terms of the GNU Genera 004 modify it under the terms of the GNU General Public License 005 as published by the Free Software Foundatio 005 as published by the Free Software Foundation; either version 2 006 of the License, or (at your option) any lat 006 of the License, or (at your option) any later version. 007 007 008 This program is distributed in the hope tha 008 This program is distributed in the hope that it will be useful, 009 but WITHOUT ANY WARRANTY; without even the 009 but WITHOUT ANY WARRANTY; without even the implied warranty of 010 MERCHANTABILITY or FITNESS FOR A PARTICULAR 010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 011 GNU General Public License for more details 011 GNU General Public License for more details. 012 012 013 You should have received a copy of the GNU 013 You should have received a copy of the GNU General Public License 014 along with this program; if not, write to t 014 along with this program; if not, write to the Free Software 015 Foundation, Inc., 59 Temple Place - Suite 3 015 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 016 USA. 016 USA. 017 */ 017 */ 018 #ifndef _SOS_HWSEGS_H_ 018 #ifndef _SOS_HWSEGS_H_ 019 #define _SOS_HWSEGS_H_ 019 #define _SOS_HWSEGS_H_ 020 020 021 /** 021 /** 022 * @file segments.h 022 * @file segments.h 023 * 023 * 024 * Global and local (GDT/LDT) segment descript 024 * Global and local (GDT/LDT) segment descriptor definition and 025 * structure. These segments map virtual addre 025 * structure. These segments map virtual addresses (ie 026 * data/instruction addresses, relative to the 026 * data/instruction addresses, relative to these segment descriptors) 027 * to linear addresses (ie addresses in the pa 027 * to linear addresses (ie addresses in the paged-memory space). 028 * 028 * 029 * @see Intel x86 doc, vol 3 chapter 3. 029 * @see Intel x86 doc, vol 3 chapter 3. 030 */ 030 */ 031 031 032 032 033 /* 033 /* 034 * Global segment selectors (GDT) for SOS/x86. 034 * Global segment selectors (GDT) for SOS/x86. 035 * 035 * 036 * @see gdt.h 036 * @see gdt.h 037 */ 037 */ 038 #define SOS_SEG_NULL 0 /* NULL segment, 038 #define SOS_SEG_NULL 0 /* NULL segment, unused by the procesor */ 039 #define SOS_SEG_KCODE 1 /* Kernel code se 039 #define SOS_SEG_KCODE 1 /* Kernel code segment */ 040 #define SOS_SEG_KDATA 2 /* Kernel data se 040 #define SOS_SEG_KDATA 2 /* Kernel data segment */ 041 #define SOS_SEG_UCODE 3 /* User code segm << 042 #define SOS_SEG_UDATA 4 /* User data segm << 043 #define SOS_SEG_KERNEL_TSS 5 /* Kernel TSS for << 044 041 045 042 046 #ifndef ASM_SOURCE 043 #ifndef ASM_SOURCE 047 /** 044 /** 048 * Helper macro that builds a segment register 045 * Helper macro that builds a segment register's value 049 */ 046 */ 050 #define SOS_BUILD_SEGMENT_REG_VALUE(desc_privi 047 #define SOS_BUILD_SEGMENT_REG_VALUE(desc_privilege,in_ldt,seg_index) \ 051 ( (((desc_privilege) & 0x3) << 0) \ 048 ( (((desc_privilege) & 0x3) << 0) \ 052 | (((in_ldt)?1:0) << 2) \ 049 | (((in_ldt)?1:0) << 2) \ 053 | ((seg_index) << 3) ) 050 | ((seg_index) << 3) ) 054 #else 051 #else 055 /* 052 /* 056 * Assembler-compliant version. 053 * Assembler-compliant version. 057 * 054 * 058 * Caution: In assembler code, "in_ldt" MUST b 055 * Caution: In assembler code, "in_ldt" MUST be either 1 or 0, nothing 059 * else. 056 * else. 060 */ 057 */ 061 #define SOS_BUILD_SEGMENT_REG_VALUE(desc_privi 058 #define SOS_BUILD_SEGMENT_REG_VALUE(desc_privilege,in_ldt,seg_index) \ 062 ( (((desc_privilege) & 0x3) << 0) \ 059 ( (((desc_privilege) & 0x3) << 0) \ 063 | ((in_ldt & 1) << 2) \ 060 | ((in_ldt & 1) << 2) \ 064 | ((seg_index) << 3) ) 061 | ((seg_index) << 3) ) 065 #endif 062 #endif 066 063 067 064 068 /* 065 /* 069 * Local segment selectors (LDT) for SOS/x86 066 * Local segment selectors (LDT) for SOS/x86 070 */ 067 */ 071 /* None */ 068 /* None */ 072 069 073 #endif /* _SOS_HWSEGS_H_ */ 070 #endif /* _SOS_HWSEGS_H_ */
[ source navigation ] | [ diff markup ] | [ identifier search ] | [ general search ] |