OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Sep 23, 2020 5:52 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Screen flashes after interrupts are activated
PostPosted: Wed Nov 27, 2019 5:50 pm 
Offline
Member
Member
User avatar

Joined: Sun Jul 21, 2019 7:34 am
Posts: 247
Hello.

I integrate interrupts on this guide.
Everything seems to work, but the screen flickers. I use GRUB as a loader, at the end of the article it is written how this error is fixed, but I do not understand where to insert it, in what part of the code.

Now my bootloader looks like this.


Last edited by mrjbom on Mon Dec 02, 2019 9:57 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Screen flashes after interrupts are activated
PostPosted: Thu Nov 28, 2019 2:36 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 2297
Nowhere. It's a bad idea to copy code you don't understand.

You need to set up the GDT before you can use the IDT, so perhaps read about the GDT first and come back if you have any questions.


Top
 Profile  
 
 Post subject: Re: Screen flashes after interrupts are activated
PostPosted: Thu Nov 28, 2019 11:23 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 170
You can implement GDT table code from Interrupt tutorial to your code with:
Code:
bits 32

%define MULTIBOOT_MAGIC 0x1BADB002
%define MULTIBOOT_FLAGS (1<<0 | 1<<1 | 1<<2)

section .text
align 4
multiboot_header:
    dd MULTIBOOT_MAGIC
    dd MULTIBOOT_FLAGS
    dd -(MULTIBOOT_MAGIC + MULTIBOOT_FLAGS)
    dd 0
    dd 0
    dd 0
    dd 0
    dd 0
    dd 0
    dd 800 ; width
    dd 600 ; height
    dd 32 ; bbp

global start
extern kmain

start:
  cli
  mov esp, stack_space
  push ebx
  push eax

  jmp load_gdt

  ;global descriptor table
  gdt:

  gdt_null:
  dq 0

  gdt_code:
  dw 0FFFFh
  dw 0

  db 0
  db 10011010b
  db 11001111b
  db 0

  gdt_data:
  dw 0FFFFh
  dw 0

  db 0
  db 10010010b
  db 11001111b
  db 0

  gdt_end:

  gdt_desc:
   dw gdt_end - gdt - 1
   dd gdt

  ;load gdt
  load_gdt:
    lgdt [gdt_desc]  ;load GDT

  call kmain
  hlt

section .bss
resb 8192
stack_space:


Top
 Profile  
 
 Post subject: Re: Screen flashes after interrupts are activated
PostPosted: Fri Nov 29, 2019 3:26 am 
Offline
Member
Member

Joined: Wed Sep 19, 2012 3:43 am
Posts: 91
Location: The Netherlands
You should write your own code, the code in the wiki is terrible.
Lots of duplication, no explanation on how it works, what it does, etc.

In OSdev it is vital that you understand what your code is doing and why. It will make debugging later on a lot easier.


Top
 Profile  
 
 Post subject: Re: Screen flashes after interrupts are activated
PostPosted: Fri Nov 29, 2019 3:29 am 
Offline
Member
Member
User avatar

Joined: Sun Jul 21, 2019 7:34 am
Posts: 247
Klakap wrote:
You can implement GDT table code from Interrupt tutorial to your code with:


Thanks for your help. I just did not know how to use the code from the tutorial.


Top
 Profile  
 
 Post subject: Re: Screen flashes after interrupts are activated
PostPosted: Mon Dec 02, 2019 10:00 am 
Offline
Member
Member
User avatar

Joined: Sun Jul 21, 2019 7:34 am
Posts: 247
Klakap wrote:
You can implement GDT table code from Interrupt tutorial to your code with...


Hello again.

I updated bootloader but it didn't solve the problem. I don't know what it is, it should have solved it. Do you know what else might be the problem? I hope for your help.

You can read the code in the repository

I hope you all will be clear, I don't have time to put in the repository, sorry.


Top
 Profile  
 
 Post subject: Re: Screen flashes after interrupts are activated
PostPosted: Sat Dec 07, 2019 2:14 pm 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 170
Code:
  load_gdt:
  lgdt [gdt_desc]  ;load GDT
  mov ax, 0x10
  mov ds, ax
  mov es, ax
  mov fs, ax
  mov gs, ax
  mov ss, ax
  jmp 0x08:.setcs
  .setcs:


Here is problem. It should seems as:
Code:
lgdt [gdt_desc]
jmp 0x0008:fix_cs

fix_cs:
mov ax, 0x0010
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax

mov esp, stack_space ;set stack pointer to your point

call kmain


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Majestic-12 [Bot] and 14 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group