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

PIC reconfiguration - what happens to the orginal INTERUPTs
https://forum.osdev.org/viewtopic.php?f=8&t=33697
Page 1 of 1

Author:  Harish [ Sat May 18, 2019 7:52 am ]
Post subject:  PIC reconfiguration - what happens to the orginal INTERUPTs

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.

Author:  Octocontrabass [ Sat May 18, 2019 8:25 am ]
Post subject:  Re: PIC reconfiguration - what happens to the orginal INTERU

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?

Author:  Harish [ Sat May 18, 2019 8:27 am ]
Post subject:  Re: PIC reconfiguration - what happens to the orginal INTERU

yes
thank you

Author:  Harish [ Sat May 18, 2019 8:30 am ]
Post subject:  Re: PIC reconfiguration - what happens to the orginal INTERU

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 ?

Author:  Harish [ Sat May 18, 2019 8:31 am ]
Post subject:  Re: PIC reconfiguration - what happens to the orginal INTERU

Also how can i acess my harddisk formy os

Thank you for the support .

Author:  Octocontrabass [ Sun May 19, 2019 8:11 am ]
Post subject:  Re: PIC reconfiguration - what happens to the orginal INTERU

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.

Author:  Harish [ Sun May 19, 2019 10:08 am ]
Post subject:  Re: PIC reconfiguration - what happens to the orginal INTERU

Thank you for all the help.

Author:  ~ [ Mon May 20, 2019 7:45 am ]
Post subject:  Re: PIC reconfiguration - what happens to the orginal INTERU

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.

Author:  Harish [ Mon May 20, 2019 8:58 am ]
Post subject:  Re: PIC reconfiguration - what happens to the orginal INTERU

Thank you
i will look into these topics
this was really helpful

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