flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > IDT in C

Author
Thread Post new topic Reply to topic
xleelz



Joined: 12 Mar 2011
Posts: 86
Location: In Google Code Server... waiting for someone to download me
xleelz
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:

Code:
[extern int50]
[global int50ptr]

int50ptr:
      pushad
      push es
     push ds
     call int50
  pop ds
      pop es
      popad
       iret    


my extremely small C kernel:
Code:

#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?

_________________
The person you don't know is the person that could help you the most... or rape you, whichever they prefer.
Post 20 Oct 2011, 23:16
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.