issuing SIDT _crashes_ the system?!

2000-09-21 Thread Julien Oster

Hello,

I tried getting the interrupt descriptor table register (IDTR) using
sidt but... the system crashed? it first told me about a null pointer
dereference (sorry, haven't got the oops any more) and then all processes
died away. on the console i repeatedly got the message "no vm86 information:
BAD"

What's up there? It's probably my mistake due to bad code, but I still
don't understand and I can't find a bug in the module (sorry, it's late :) ).

I passed SIDT a pointer to a structure which contains the 2 byte limit and
the 4 byte base. To ensure that it is actually modified, I put in the two
values 0xDEAD and 0xBABEFACE.

After issuing SIDT, limit and base were 0. It's clear that that isn't the
correct value for the IDTR...

here's my getidt function (NASM):

BITS 32

GLOBAL getidt

getidt: push ebp
mov ebp, esp
sidt [ebp - 4]
pop ebp
ret

and here's the C part of the module:

#define MODULE
#define __KERNEL__

#include 
#include 

struct idtr {
unsigned short limit;
unsigned char * base;
};

extern void getidt (struct idtr *);

int init_module (void) {
struct idtr aidtr = {
0xDEAD,
(void*)0xBABEFACE
};

printk ("1 limit: %hu, base: %p\n", aidtr.limit, aidtr.base);
getidt (&aidtr);
printk ("2 limit: %hu, base: %p\n", aidtr.limit, aidtr.base);

return -1;
}

void cleanup_module (void) {
return;
}

any ideas?

Julien



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/



interrupt magic

2000-09-22 Thread Julien Oster

Hello,

I'm currently using 2.4.0-test5 and no APIC.

I'm trying to learn a bit about protected mode programming on i386
architectures.

Looking at the interrupts, the interrupt descriptor table, interrupt gates
and all those things I wanted to experiment a bit to see if I understood
correctly.

So I wrote the opcode 0xCF (IRET) into the first byte of the interrupt
handler for the keyboard controller (I got the address of the handler
directly from the IDT) and checked if I still have a keyboard.

No, I had no keyboard, but one thing confused me. After waiting a bit,
I got the kernel complaining about lost interrupts from the harddisk. The
ethernet card said pretty much the same thing. And plugging in an USB
device made the kernel also complain.

So it seems that I "masked" out a little bit more than the keyboard
interrupt (IRQ 1, entry 0x21 in the IDT). And it happens with _every_
interrupt I try with: when it gets called once, the kernel fails.

I did a lot of debugging, read a lot of C and assembler source code... but
I simply can't find what it is that renders the computer in such an
unusable state.

So... what do interrupt handlers, even the dummy standard ones, do to keep
the system running... and why won't it work without that?

Thanks,
Julien



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/