OSDev.org
https://forum.osdev.org/

Screen flashes after interrupts are activated
https://forum.osdev.org/viewtopic.php?f=1&t=36314
Page 1 of 1

Author:  mrjbom [ Wed Nov 27, 2019 5:50 pm ]
Post subject:  Screen flashes after interrupts are activated

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.

Author:  Octocontrabass [ Thu Nov 28, 2019 2:36 am ]
Post subject:  Re: Screen flashes after interrupts are activated

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.

Author:  Klakap [ Thu Nov 28, 2019 11:23 am ]
Post subject:  Re: Screen flashes after interrupts are activated

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:

Author:  FusT [ Fri Nov 29, 2019 3:26 am ]
Post subject:  Re: Screen flashes after interrupts are activated

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.

Author:  mrjbom [ Fri Nov 29, 2019 3:29 am ]
Post subject:  Re: Screen flashes after interrupts are activated

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.

Author:  mrjbom [ Mon Dec 02, 2019 10:00 am ]
Post subject:  Re: Screen flashes after interrupts are activated

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.

Author:  Klakap [ Sat Dec 07, 2019 2:14 pm ]
Post subject:  Re: Screen flashes after interrupts are activated

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

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/