bug-grub
[Top][All Lists]
Advanced

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

software interrupts from a multiboot-compliant kernel


From: Timmy Douglas
Subject: software interrupts from a multiboot-compliant kernel
Date: Sun, 10 Feb 2002 12:38:19 -0600 (CST)

I made a multiboot compliant kernel using the demo files that came
with grub: boot.S, multiboot.h, and kernel.c. I wanted to do some
vesa/vga stuff and I figured out that software interrupts (int 10h)
are probably the best way to do that.

However, I did not expect that doing this would be so complicated in
x86 assembly. I think GRUB puts my kernel in protected mode, and I
have to change it to real mode or v86 mode to do the software
interrupts that I want to do. I've spent about 3 weeks now looking at
the intel docs and learning asm and it looks like switching back to
real mode to do it would be easier than setting up v86 mode. I found
some assembly code in grub/stage2/asm.S that switches
pmode<->rmode. But when I insert the code my computer triple faults
(resets) around here:

(in prot_to_real:)
        /* set up segment limits */
        movw    $PSEUDO_RM_DSEG, %ax
        movw    %ax, %ds
        movw    %ax, %es
        movw    %ax, %fs
        movw    %ax, %gs
        movw    %ax, %ss

I don't know how I can fix this because I do not know where the
numbers in the #defines come from:

#define PROT_MODE_CSEG  0x8
#define PROT_MODE_DSEG  0x10
#define PSEUDO_RM_CSEG  0x18
#define PSEUDO_RM_DSEG  0x20
#define STACKOFF        (0x2000 - 0x10)


if anyone could explain or provide an example for this---it would be
great,


thanks for any help,



reply via email to

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