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