hi
can someone please explain the following code snippet to me:

06444 ! Copy the monitor global descriptor table to the address space
of kernel and
06445 ! switch over to it. Prot_init() can then update it with
immediate effect.
06446
06447 sgdt (_gdt+GDT_SELECTOR) ! get the
monitor gdtr
06448 mov esi, (_gdt+GDT_SELECTOR+2) ! absolute
address of GDT
06449 mov ebx, _gdt ! address of
kernel GDT
06450 mov ecx, 8*8 ! copying eight
descriptors
06451 copygdt:
06452 eseg movb al, (esi)
06453 movb (ebx), al
06454 inc esi
06455 inc ebx
06456 loop copygdt
06457 mov eax, (_gdt+DS_SELECTOR+2) ! base of
kernel data
06458 and eax, 0x00FFFFFF ! only 24 bits
06459 add eax, _gdt ! eax =
vir2phys(gdt)
06460 mov (_gdt+GDT_SELECTOR+2), eax ! set base of
GDT
06461 lgdt (_gdt+GDT_SELECTOR)

my problems are as follows:
1.
Line 6448 says "mov esi, (_gdt+GDT_SELECTOR+2)". Why "+2", is that
because we need to jump over the limit?
2.
Line 6457 says "mov eax, (_gdt+DS_SELECTOR+2)". How could this
possibly be the base of the kernel data? I mean, afaik, the base
address in a segment descriptor is to be found in bits 16-40 and 56-64
within the descriptor? Is it that we're ignoring bits 56-64? It would
also explain why line 6458 zeroes out two nibbles in the base address,
but is that neat programming practice?
3.
When creating the kernel gdt, I don't actually understand how its
limit is set! Line 6450 causes 8 descriptors to be copied but this
very gdt size is not explicitly set with a "mov (gdt_GDT_SELECTOR),
8*8"! Instead, we just copy whatever limit is set in the boot monitor
gdt, so my question again is: is this good programming practice?

thanx,

Martin