I've decided to write the kernel of my OS in C, but I came across a problem with the IDT. I'm not sure exactly what happens, but it seems to happen when calling int 50
isrs.asm:
[extern int50]
[global int50ptr]
int50ptr:
pushad
push es
push ds
call int50
pop ds
pop es
popad
iret
my extremely small C kernel:
#include "./kernel/idt.h"
#include "./kernel/datastruc.h"
#include "./kernel/io.h"
#include "./kernel/pic.h"
extern void int50ptr(void);
void int50(void);
void kmain()
{
ints(false);
maskIrq(ALL);
addisr(0x50,int50ptr,0);
setIDT();
unsigned char *vidmem = (unsigned char *) 0xB8000;
for(int i=0;i<=160*25;i+=2)
{
vidmem[i]=' ';
vidmem[i+1]=0x1f;
}
ints(true);
__asm__ volatile("int $0x50");
vidmem[0] = 'A';
vidmem[1] = 0x1f;
__asm__ volatile ("cli;hlt");
}
void int50(void)
{
unsigned char *vidmem = (unsigned char *) 0xB8E00;
vidmem[0] = 'U';
}
wasn't sure if I should post this in OS dev or HLL, so I chose HLL. Does anyone have any advice or a detailed explanation of what I did wrong?