formatting nits

This commit is contained in:
rsc 2006-09-08 15:14:43 +00:00
parent efb01c1dc0
commit 4fb684548a
4 changed files with 17 additions and 13 deletions

View file

@ -37,7 +37,7 @@ ioapic_init(void)
uchar id; uchar id;
int i; int i;
if (!ismp) if(!ismp)
return; return;
io = (struct ioapic*) IO_APIC_BASE; io = (struct ioapic*) IO_APIC_BASE;
@ -71,7 +71,7 @@ ioapic_enable (int irq, int cpunum)
uint l, h; uint l, h;
struct ioapic *io; struct ioapic *io;
if (!ismp) if(!ismp)
return; return;
io = (struct ioapic*) IO_APIC_BASE; io = (struct ioapic*) IO_APIC_BASE;

14
lapic.c
View file

@ -105,7 +105,7 @@ lapic_write(int r, int data)
void void
lapic_timerinit(void) lapic_timerinit(void)
{ {
if (!lapicaddr) if(!lapicaddr)
return; return;
lapic_write(LAPIC_TDCR, LAPIC_X1); lapic_write(LAPIC_TDCR, LAPIC_X1);
@ -118,7 +118,7 @@ lapic_timerinit(void)
void void
lapic_timerintr(void) lapic_timerintr(void)
{ {
if (lapicaddr) if(lapicaddr)
lapic_write(LAPIC_EOI, 0); lapic_write(LAPIC_EOI, 0);
} }
@ -127,7 +127,7 @@ lapic_init(int c)
{ {
uint r, lvt; uint r, lvt;
if (!lapicaddr) if(!lapicaddr)
return; return;
lapic_write(LAPIC_DFR, 0xFFFFFFFF); // Set dst format register lapic_write(LAPIC_DFR, 0xFFFFFFFF); // Set dst format register
@ -162,21 +162,21 @@ lapic_init(int c)
void void
lapic_enableintr(void) lapic_enableintr(void)
{ {
if (lapicaddr) if(lapicaddr)
lapic_write(LAPIC_TPR, 0); lapic_write(LAPIC_TPR, 0);
} }
void void
lapic_disableintr(void) lapic_disableintr(void)
{ {
if (lapicaddr) if(lapicaddr)
lapic_write(LAPIC_TPR, 0xFF); lapic_write(LAPIC_TPR, 0xFF);
} }
void void
lapic_eoi(void) lapic_eoi(void)
{ {
if (lapicaddr) if(lapicaddr)
lapic_write(LAPIC_EOI, 0); lapic_write(LAPIC_EOI, 0);
} }
@ -184,7 +184,7 @@ int
cpu(void) cpu(void)
{ {
int x; int x;
if (lapicaddr) if(lapicaddr)
x = (lapic_read(LAPIC_ID)>>24) & 0xFF; x = (lapic_read(LAPIC_ID)>>24) & 0xFF;
else else
x = 0; x = 0;

9
main.c
View file

@ -74,8 +74,10 @@ main0(void)
mp_startthem(); mp_startthem();
// turn on timer // turn on timer
if (ismp) lapic_timerinit(); if(ismp)
else pit8253_timerinit(); lapic_timerinit();
else
pit8253_timerinit();
// enable interrupts on the local APIC // enable interrupts on the local APIC
lapic_enableintr(); lapic_enableintr();
@ -126,7 +128,8 @@ process0()
p0->cwd = iget(rootdev, 1); p0->cwd = iget(rootdev, 1);
iunlock(p0->cwd); iunlock(p0->cwd);
// dummy user memory to make copyproc() happy // dummy user memory to make copyproc() happy.
// must be big enough to hold the init binary.
p0->sz = PAGE; p0->sz = PAGE;
p0->mem = kalloc(p0->sz); p0->mem = kalloc(p0->sz);

3
mp.c
View file

@ -191,7 +191,8 @@ mp_init(void)
int int
mp_bcpu(void) mp_bcpu(void)
{ {
if (ismp) return bcpu-cpus; if(ismp)
return bcpu-cpus;
else return 0; else return 0;
} }