Working PIT irqs, fix GDT bugs
This commit is contained in:
@@ -29,8 +29,10 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <libk/types.h>
|
||||
#include <sys/pic.h>
|
||||
#include <sys/ioport.h>
|
||||
#include <sys/isr.h>
|
||||
|
||||
#define PIC1 0x20
|
||||
#define PIC2 0xA0
|
||||
@@ -38,6 +40,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define PIC1_DATA (PIC1 + 1)
|
||||
#define PIC2_CMD PIC2
|
||||
#define PIC2_DATA (PIC2 + 1)
|
||||
#define PIC_EOI 0x20
|
||||
|
||||
#define ICW1_ICW4 0x01
|
||||
#define ICW1_SINGLE 0x02
|
||||
@@ -62,10 +65,10 @@ void pic_init(void) {
|
||||
ioport_out8(PIC2_CMD, ICW1_INIT | ICW1_ICW4);
|
||||
ioport_wait();
|
||||
|
||||
ioport_out8(PIC1_DATA, 4);
|
||||
ioport_out8(PIC1_DATA, 0x20);
|
||||
ioport_wait();
|
||||
|
||||
ioport_out8(PIC2_DATA, 2);
|
||||
ioport_out8(PIC2_DATA, 0x28);
|
||||
ioport_wait();
|
||||
|
||||
ioport_out8(PIC1_DATA, 1<<CASCADE_IRQ);
|
||||
@@ -79,6 +82,28 @@ void pic_init(void) {
|
||||
ioport_out8(PIC2_DATA, ICW4_8086);
|
||||
ioport_wait();
|
||||
|
||||
ioport_out8(PIC1_DATA, 0xFF);
|
||||
ioport_out8(PIC2_DATA, 0xFF);
|
||||
pic_mask();
|
||||
}
|
||||
|
||||
void pic_mask(void) {
|
||||
ioport_out8(PIC1_DATA, 0xFF);
|
||||
ioport_wait();
|
||||
ioport_out8(PIC2_DATA, 0xFF);
|
||||
ioport_wait();
|
||||
}
|
||||
|
||||
void pic_unmask(void) {
|
||||
ioport_out8(PIC1_DATA, 0);
|
||||
ioport_wait();
|
||||
ioport_out8(PIC2_DATA, 0);
|
||||
ioport_wait();
|
||||
}
|
||||
|
||||
void pic_fini(uint8_t trap) {
|
||||
if (trap >= 40) {
|
||||
ioport_out8(PIC2_CMD, PIC_EOI);
|
||||
ioport_wait();
|
||||
}
|
||||
ioport_out8(PIC1_CMD, PIC_EOI);
|
||||
ioport_wait();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user