From 4f14d8d1e594bdf45e36a035f6c3fd4ca959711e Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Wed, 9 Aug 2017 07:43:06 -0400 Subject: [PATCH] Commit to running on an SMP (perhaps with only 1 core). Remove most code from picirq.c and remove timer.c completely. Update runoff.list. --- Makefile | 1 - console.c | 1 - ide.c | 1 - ioapic.c | 6 ----- main.c | 4 +-- mp.c | 13 +++------- picirq.c | 70 +---------------------------------------------------- runoff.list | 2 -- timer.c | 32 ------------------------ uart.c | 1 - 10 files changed, 6 insertions(+), 125 deletions(-) delete mode 100644 timer.c diff --git a/Makefile b/Makefile index c6159fe1ed..06eea5d291 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,6 @@ OBJS = \ syscall.o\ sysfile.o\ sysproc.o\ - timer.o\ trapasm.o\ trap.o\ uart.o\ diff --git a/console.c b/console.c index ca00a5fa6a..a280d2ba60 100644 --- a/console.c +++ b/console.c @@ -294,7 +294,6 @@ consoleinit(void) devsw[CONSOLE].read = consoleread; cons.locking = 1; - picenable(IRQ_KBD); ioapicenable(IRQ_KBD, 0); } diff --git a/ide.c b/ide.c index 881fe0dce3..b4c0b1f771 100644 --- a/ide.c +++ b/ide.c @@ -53,7 +53,6 @@ ideinit(void) int i; initlock(&idelock, "ide"); - picenable(IRQ_IDE); ioapicenable(IRQ_IDE, ncpu - 1); idewait(0); diff --git a/ioapic.c b/ioapic.c index 0e9116f9a5..cb0f015c6b 100644 --- a/ioapic.c +++ b/ioapic.c @@ -50,9 +50,6 @@ ioapicinit(void) { int i, id, maxintr; - if(!ismp) - return; - ioapic = (volatile struct ioapic*)IOAPIC; maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; id = ioapicread(REG_ID) >> 24; @@ -70,9 +67,6 @@ ioapicinit(void) void ioapicenable(int irq, int cpunum) { - if(!ismp) - return; - // Mark interrupt edge-triggered, active high, // enabled, and routed to the given cpunum, // which happens to be that cpu's APIC ID. diff --git a/main.c b/main.c index e5b7d6453e..6bdeab4e03 100644 --- a/main.c +++ b/main.c @@ -22,7 +22,7 @@ main(void) mpinit(); // detect other processors lapicinit(); // interrupt controller seginit(); // segment descriptors - picinit(); // another interrupt controller + picinit(); // disable pic ioapicinit(); // another interrupt controller consoleinit(); // console hardware uartinit(); // serial port @@ -31,8 +31,6 @@ main(void) binit(); // buffer cache fileinit(); // file table ideinit(); // disk - if(!ismp) - timerinit(); // uniprocessor timer startothers(); // start other processors kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers() userinit(); // first user process diff --git a/mp.c b/mp.c index ade8930b37..79bb0ada4d 100644 --- a/mp.c +++ b/mp.c @@ -12,7 +12,6 @@ #include "proc.h" struct cpu cpus[NCPU]; -int ismp; int ncpu; uchar ioapicid; @@ -93,13 +92,14 @@ void mpinit(void) { uchar *p, *e; + int ismp; struct mp *mp; struct mpconf *conf; struct mpproc *proc; struct mpioapic *ioapic; if((conf = mpconfig(&mp)) == 0) - return; + panic("Expect to run on an SMP"); ismp = 1; lapic = (uint*)conf->lapicaddr; for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; pimcrp){ // Bochs doesn't support IMCR, so this doesn't run on Bochs. diff --git a/picirq.c b/picirq.c index 69785a7a32..e26957f041 100644 --- a/picirq.c +++ b/picirq.c @@ -1,5 +1,3 @@ -// Intel 8259A programmable interrupt controllers. - #include "types.h" #include "x86.h" #include "traps.h" @@ -8,79 +6,13 @@ #define IO_PIC1 0x20 // Master (IRQs 0-7) #define IO_PIC2 0xA0 // Slave (IRQs 8-15) -#define IRQ_SLAVE 2 // IRQ at which slave connects to master - -// Current IRQ mask. -// Initial IRQ mask has interrupt 2 enabled (for slave 8259A). -static ushort irqmask = 0xFFFF & ~(1<> 8); -} - -void -picenable(int irq) -{ - picsetmask(irqmask & ~(1<