OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 3:29 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: PIC reconfiguration - what happens to the orginal INTERUPTs
PostPosted: Sat May 18, 2019 7:52 am 
Offline

Joined: Sat May 18, 2019 7:43 am
Posts: 6
HI,
i have seen and read the code the for PIC reconfiguration on using IDT, it is said that PIC is already configured with interupts
IRQ 0 ‒ system timer
IRQ 1 — keyboard controller
IRQ 3 — serial port COM2
IRQ 4 — serial port COM1
IRQ 5 — line print terminal 2
IRQ 6 — floppy controller
IRQ 7 — line print terminal 1
IRQ 8 — RTC timer
IRQ 12 — mouse controller
IRQ 13 — math co-processor
IRQ 14 — ATA channel 1
IRQ 15 — ATA channel 2
so we reconfigure to start from 32 (0x20) in the code so what happens to the initial 16 interrupts.
i am guessing i am missing some point here and this might be a stupid question.
could any please clarify on this.


Top
 Profile  
 
 Post subject: Re: PIC reconfiguration - what happens to the orginal INTERU
PostPosted: Sat May 18, 2019 8:25 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
The PIC is a component that translates from IRQ to interrupt. You can't change which device is using each IRQ, those are physical connections between the hardware and the PICs. What you can change is how the PICs translate from IRQ to interrupt.

When an AT-compatible PC first boots up, this is how the PICs are configured:

IRQ 0 — interrupt 8 (0x8) — system timer
IRQ 1 — interrupt 9 (0x9) — keyboard controller
IRQ 3 — interrupt 11 (0xB) — serial port COM2
IRQ 4 — interrupt 12 (0xC) — serial port COM1
IRQ 5 — interrupt 13 (0xD) — line print terminal 2
IRQ 6 — interrupt 14 (0xE) — floppy controller
IRQ 7 — interrupt 15 (0xF) — line print terminal 1
IRQ 8 — interrupt 112 (0x70) — RTC timer
IRQ 12 — interrupt 116 (0x74) — mouse controller
IRQ 13 — interrupt 117 (0x75) — math co-processor
IRQ 14 — interrupt 118 (0x76) — ATA channel 1
IRQ 15 — interrupt 119 (0x77) — ATA channel 2

When you reprogram the PICs to start at interrupt 32 (0x20), the new mapping will look like this:

IRQ 0 — interrupt 32 (0x20) — system timer
IRQ 1 — interrupt 33 (0x21) — keyboard controller
IRQ 3 — interrupt 35 (0x23) — serial port COM2
IRQ 4 — interrupt 36 (0x24) — serial port COM1
IRQ 5 — interrupt 37 (0x25) — line print terminal 2
IRQ 6 — interrupt 38 (0x26) — floppy controller
IRQ 7 — interrupt 39 (0x27) — line print terminal 1
IRQ 8 — interrupt 40 (0x28) — RTC timer
IRQ 12 — interrupt 44 (0x2C) — mouse controller
IRQ 13 — interrupt 45 (0x2D) — math co-processor
IRQ 14 — interrupt 46 (0x2E) — ATA channel 1
IRQ 15 — interrupt 47 (0x2F) — ATA channel 2

Does that make sense?


Top
 Profile  
 
 Post subject: Re: PIC reconfiguration - what happens to the orginal INTERU
PostPosted: Sat May 18, 2019 8:27 am 
Offline

Joined: Sat May 18, 2019 7:43 am
Posts: 6
yes
thank you


Top
 Profile  
 
 Post subject: Re: PIC reconfiguration - what happens to the orginal INTERU
PostPosted: Sat May 18, 2019 8:30 am 
Offline

Joined: Sat May 18, 2019 7:43 am
Posts: 6
Hi
thank you for your reply.
i had one more doubt what the magical number that we used in the bare bone tutorial.
Also in order for me to load my os in my pc how will my grub know where my os ?


Top
 Profile  
 
 Post subject: Re: PIC reconfiguration - what happens to the orginal INTERU
PostPosted: Sat May 18, 2019 8:31 am 
Offline

Joined: Sat May 18, 2019 7:43 am
Posts: 6
Also how can i acess my harddisk formy os

Thank you for the support .


Top
 Profile  
 
 Post subject: Re: PIC reconfiguration - what happens to the orginal INTERU
PostPosted: Sun May 19, 2019 8:11 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
Harish wrote:
what the magical number that we used in the bare bone tutorial.

The bootloader looks for the magic number to see if your kernel is compatible with Multiboot.

Harish wrote:
Also in order for me to load my os in my pc how will my grub know where my os ?

GRUB will read grub.cfg to know where to look.

Harish wrote:
Also how can i acess my harddisk formy os

You'll need to search the PCI bus for your computer's storage controller, then write a driver for that controller. Most modern computers use AHCI, but older computers use IDE instead.


Top
 Profile  
 
 Post subject: Re: PIC reconfiguration - what happens to the orginal INTERU
PostPosted: Sun May 19, 2019 10:08 am 
Offline

Joined: Sat May 18, 2019 7:43 am
Posts: 6
Thank you for all the help.


Top
 Profile  
 
 Post subject: Re: PIC reconfiguration - what happens to the orginal INTERU
PostPosted: Mon May 20, 2019 7:45 am 
Offline
Member
Member
User avatar

Joined: Tue Mar 06, 2007 11:17 am
Posts: 1225
Harish wrote:
Also how can i acess my harddisk formy os

Thank you for the support .
You could save the whole original configuration to easily exit your kernel like a normal application and restore the state before loading it.

For reading/accessing the hard disks, you need to study how to implement storage devices for 1 whole year for being able to formally implement and test the primitives. You could start with my code, look at the BOOTCFG/ldr/4/LowEST-Kernel-LEVEL-1-2019-01--src/disks/ATA/commands/ directory and for VERY accurate ATA/ATAPI detection (even for old ATA-3 disks from 386 laptops), BOOTCFG/LowEST/x86s/HDD/ATA/utils/atadetec/main16.asm. You can study, reimplement and continue from there for 1 year, por ATA, ATAPI, floppy disks. You will probably need another year for SATA, and another year for USB.

You need to study all aspects, accessing the disks with LBA28, LBA48, bus master with the help of FreeDOS, and of course file systems like FAT in CHS and LBA modes, NTFS, ext3, although for more complex file systems like the ones from Linux and NTFS, you will also need 1 year to reimplement if you work alone.

_________________
Live PC 1: Image Live PC 2: Image

YouTube:
http://youtube.com/@AltComp126/streams
http://youtube.com/@proyectos/streams

http://master.dl.sourceforge.net/projec ... 7z?viasf=1


Top
 Profile  
 
 Post subject: Re: PIC reconfiguration - what happens to the orginal INTERU
PostPosted: Mon May 20, 2019 8:58 am 
Offline

Joined: Sat May 18, 2019 7:43 am
Posts: 6
Thank you
i will look into these topics
this was really helpful


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 20 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