From ec494ffbfc88b2085d8d4824883333b782c50b5c Mon Sep 17 00:00:00 2001 From: Jan Dolezal Date: Thu, 20 Nov 2014 15:00:26 +0100 Subject: i386/pc386: configurable size of descriptor tables --- c/src/lib/libbsp/i386/pc386/startup/ldsegs.S | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'c/src/lib/libbsp/i386/pc386/startup/ldsegs.S') diff --git a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S index 495d68ae9d..14cbb9599b 100644 --- a/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S +++ b/c/src/lib/libbsp/i386/pc386/startup/ldsegs.S @@ -34,6 +34,7 @@ +--------------------------------------------------------------------------*/ #include +#include /* contains sizes of GDT and IDT */ /*----------------------------------------------------------------------------+ | CODE section @@ -167,6 +168,9 @@ next_step: /*---------------------------------------------------------------------------+ | GDT itself +--------------------------------------------------------------------------*/ +#if GDT_SIZE < 3 +#error "GDT_SIZE must be at least 3" +#endif BEGIN_DATA .p2align 4 @@ -186,11 +190,17 @@ SYM (_Global_descriptor_table): .word 0xffff, 0 .byte 0, 0x92, 0xcf, 0 + /* allocated space for user segments */ + .rept (GDT_SIZE - 3) + .word 0,0,0,0 + .endr + /*---------------------------------------------------------------------------+ | Descriptor of GDT +--------------------------------------------------------------------------*/ -SYM (gdtdesc): - .word (3*8 - 1) + PUBLIC(gdtdesc) +SYM(gdtdesc): + .word (GDT_SIZE*8 - 1) .long SYM (_Global_descriptor_table) /*---------------------------------------------------------------------------+ @@ -200,7 +210,7 @@ SYM (gdtdesc): PUBLIC(Interrupt_descriptor_table) SYM(Interrupt_descriptor_table): - .rept 256 + .rept IDT_SIZE .word 0,0,0,0 .endr @@ -211,7 +221,7 @@ SYM(Interrupt_descriptor_table): .p2align 4 PUBLIC(IDT_Descriptor) SYM(IDT_Descriptor): - .word (256*8 - 1) + .word (IDT_SIZE*8 - 1) .long SYM (Interrupt_descriptor_table) END_DATA -- cgit v1.2.3