bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GRUB to kernel: Problem in switching the GDT register


From: Wang Weihan
Subject: GRUB to kernel: Problem in switching the GDT register
Date: Tue, 9 Oct 2001 23:27:41 +0800

Hi! all,

I'm writing a piece of 'glue' code which is to connect GRUB's booting process
and our newly developed OS kernel.

Our kernel uses another GDT Table instead of which GRUB provides. So I wrote
the following codes to switch GDT register. Base address of code segment in the
new GDT is assumed to be CODE_BASE (and the old one is 0, defined by GRUB). 
This codes are compiled under M$'s masm.exe:

;; ...
;; initialize GDT and its pointer

        lgdt    gdt_pointer

        db      0eah                    ;; machine code for jmp seg16:offset32
        dd      offset  lUseNewGdt      ;; offset32. just the physical addr.
        dw      - CODE_BASE             ;; seg16

lUseNewGdt:
        ;; ...
        ;; more codes under new GDT
        
        
But why the machine always reboots whenever it reaches that jmp instruction?
I swear that the GDT and it's pointer are set properly, and 'offset lUseNewGdt'
is the right physical address.

BTW, 1. Is there any other way to switch GDT and go on running?
     2. Has GRUB supported CPUs other than Ix86? 
     thanks!




Best regards,
Wang Weihan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]