diff --git a/core/gdt.c b/core/gdt.c index ff0df71..2897b30 100644 --- a/core/gdt.c +++ b/core/gdt.c @@ -61,7 +61,7 @@ struct x86_gdt_register { /* This is not exactly a "virtual" address, ie an adddress such as those of instructions and data; this is a "linear" address, ie an - address in the paged memory. However, in SOS we configure the + address in the paged memory. However, we configure the segmented memory as a "flat" space: the 0-4GB segment-based (ie "virtual") addresses directly map to the 0-4GB paged memory (ie "linear"), so that the "linear" addresses are numerically equal @@ -106,12 +106,12 @@ struct x86_gdt_register { /** The actual GDT */ static struct x86_segment_descriptor gdt[] = { - [SOS_SEG_NULL] = + [SEG_NULL] = (struct x86_segment_descriptor){ 0, }, - [SOS_SEG_KCODE] = BUILD_GDTE(0, 1), - [SOS_SEG_KDATA] = BUILD_GDTE(0, 0), + [SEG_KCODE] = BUILD_GDTE(0, 1), + [SEG_KDATA] = BUILD_GDTE(0, 0), }; int gdtSetup(void) @@ -139,8 +139,8 @@ int gdtSetup(void) movw %%ax, %%fs \n\ movw %%ax, %%gs" : - : "m"(gdtr), "i"(SOS_BUILD_SEGMENT_REG_VALUE(0, FALSE, SOS_SEG_KCODE)), - "i"(SOS_BUILD_SEGMENT_REG_VALUE(0, FALSE, SOS_SEG_KDATA)) + : "m"(gdtr), "i"(BUILD_SEGMENT_REG_VALUE(0, FALSE, SEG_KCODE)), + "i"(BUILD_SEGMENT_REG_VALUE(0, FALSE, SEG_KDATA)) : "memory", "eax"); return 0; diff --git a/core/gdt.h b/core/gdt.h index 8957891..b3cf7c5 100644 --- a/core/gdt.h +++ b/core/gdt.h @@ -16,15 +16,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _SOS_GDT_H_ -#define _SOS_GDT_H_ +#pragma once /** * @file gdt.h * * The routines that manage the GDT, the table that maps the virtual * addresses (data/instructions, segment-relative), to "linear" - * addresses (ie paged-memory). In SOS/x86, we use a "flat" virtual + * addresses (ie paged-memory). Here, we use a "flat" virtual * space, ie the virtual and linear spaces are equivalent. * * @see Intel x86 doc vol 3, chapter 3 @@ -36,4 +35,3 @@ */ int gdtSetup(void); -#endif /* _SOS_GDT_H_ */ diff --git a/core/segment.h b/core/segment.h index 0a4b24e..f5d5961 100644 --- a/core/segment.h +++ b/core/segment.h @@ -16,8 +16,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _SOS_HWSEGS_H_ -#define _SOS_HWSEGS_H_ +#pragma once /** * @file segments.h @@ -37,15 +36,15 @@ * * @see gdt.h */ -#define SOS_SEG_NULL 0 /* NULL segment, unused by the procesor */ -#define SOS_SEG_KCODE 1 /* Kernel code segment */ -#define SOS_SEG_KDATA 2 /* Kernel data segment */ +#define SEG_NULL 0 /* NULL segment, unused by the procesor */ +#define SEG_KCODE 1 /* Kernel code segment */ +#define SEG_KDATA 2 /* Kernel data segment */ /** * Helper macro that builds a segment register's value */ -#define SOS_BUILD_SEGMENT_REG_VALUE(desc_privilege,in_ldt,seg_index) \ +#define BUILD_SEGMENT_REG_VALUE(desc_privilege,in_ldt,seg_index) \ ( (((desc_privilege) & 0x3) << 0) \ | (((in_ldt)?1:0) << 2) \ | ((seg_index) << 3) ) @@ -55,5 +54,3 @@ * Local segment selectors (LDT) for SOS/x86 */ /* None */ - -#endif /* _SOS_HWSEGS_H_ */