Linux boot code

Hello,
I'm trying to learn a little bit about the boot process with linux. I have been looking at the source code and I'm having a problem with part of the source code. I can't seem to get the source code to compile. Can anyone help with this? It crashes at the part where I am setting the IDT. The code section follows. If you are looking for the full working version the file is at /usr/src/linux-/arch/i386/boot/setup.S

****** Excerpt from setup.S *************************8
# set up gdt and idt
# this next line is the one I'm having trouble with...
lidt idt_48 # load idt with 0,0
xorl %eax, %eax # Compute gdt_base
movw %ds, %ax # (Convert %ds:gdt)
shll $4, %eax
addl $gdt, %eax
movl %eax, (gdt_48+2)
lgdt gdt_48 # load gdt with whatever

# these next lines are found at the end of the file as defines
# Descriptor tables
gdt:
.word 0, 0, 0, 0 # dummy
.word 0, 0, 0, 0 # unused

.word 0xFFFF # 4Gb - (0x100000*0x1000)
.word 0 # base address = 0
.word 0x9A00 # code read/exec
.word 0x00CF # granularity = 4096, 386
# (+5th nibble of limit)

.word 0xFFFF # 4Gb - (0x100000*0x1000)
.word 0 # base address = 0
.word 0x9200 # data read/write
.word 0x00CF # granularity = 4096, 386
# (+5th nibble of limit)
idt_48:
.word 0 # idt limit = 0
.word 0, 0 # idt base = 0L
gdt_48:
.word 0x8000 # gdt limit=2048,
# 256 GDT entries

.word 0, 0 # gdt base

*********** End excerpt *************************

Thanks for any help,
Rory
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories