summaryrefslogtreecommitdiff
path: root/mp.c
diff options
context:
space:
mode:
authorrtm <rtm>2006-06-22 20:47:23 +0000
committerrtm <rtm>2006-06-22 20:47:23 +0000
commitdf5cc91659b0a2190072e6fc305060c8de95ed82 (patch)
tree0965b8a673f0e2ddab08b2135ab1499f6455c648 /mp.c
parentbf49aedbed02cdbf40430178847d34c48c36c693 (diff)
downloadxv6-labs-df5cc91659b0a2190072e6fc305060c8de95ed82.tar.gz
xv6-labs-df5cc91659b0a2190072e6fc305060c8de95ed82.tar.bz2
xv6-labs-df5cc91659b0a2190072e6fc305060c8de95ed82.zip
compile "user programs"
curproc array
Diffstat (limited to 'mp.c')
-rw-r--r--mp.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/mp.c b/mp.c
index d3db697..e797f81 100644
--- a/mp.c
+++ b/mp.c
@@ -97,7 +97,7 @@ static uint32_t *lapicaddr;
static struct cpu {
uint8_t apicid; /* Local APIC ID */
int lintr[2]; /* Local APIC */
-} cpu[NCPU];
+} cpus[NCPU];
static int ncpu;
static struct cpu *bcpu;
@@ -113,7 +113,7 @@ lapic_write(int r, int data)
*(lapicaddr+(r/sizeof(*lapicaddr))) = data;
}
-static void
+void
lapic_init(int c)
{
uint32_t r, lvt;
@@ -131,8 +131,8 @@ lapic_init(int c)
* LINT[01] are set to ExtINT.
* Acknowledge any outstanding interrupts.
*/
- lapic_write(LAPIC_LINT0, cpu[c].lintr[0]);
- lapic_write(LAPIC_LINT1, cpu[c].lintr[1]);
+ lapic_write(LAPIC_LINT0, cpus[c].lintr[0]);
+ lapic_write(LAPIC_LINT1, cpus[c].lintr[1]);
lapic_write(LAPIC_EOI, 0);
lvt = (lapic_read(LAPIC_VER)>>16) & 0xFF;
@@ -168,7 +168,7 @@ lapic_online(void)
}
int
-lapic_cpu_number(void)
+cpu(void)
{
return (lapic_read(LAPIC_ID)>>24) & 0xFF;
}
@@ -312,12 +312,12 @@ mp_init()
switch(*p){
case MPPROCESSOR:
proc = (struct MPPE *) p;
- cpu[ncpu].apicid = proc->apicid;
- cpu[ncpu].lintr[0] = APIC_IMASK;
- cpu[ncpu].lintr[1] = APIC_IMASK;
- cprintf("a processor %x\n", cpu[ncpu].apicid);
+ cpus[ncpu].apicid = proc->apicid;
+ cpus[ncpu].lintr[0] = APIC_IMASK;
+ cpus[ncpu].lintr[1] = APIC_IMASK;
+ cprintf("a processor %x\n", cpus[ncpu].apicid);
if (proc->flags & MPBP) {
- bcpu = &cpu[ncpu];
+ bcpu = &cpus[ncpu];
}
ncpu++;
p += sizeof(struct MPPE);
@@ -342,8 +342,8 @@ mp_init()
}
}
- lapic_init(cpu-bcpu);
- cprintf("ncpu: %d boot %d\n", ncpu, cpu-bcpu);
+ lapic_init(bcpu-cpus);
+ cprintf("ncpu: %d boot %d\n", ncpu, bcpu-cpus);
lapic_online();
@@ -352,12 +352,12 @@ mp_init()
(uint32_t) _binary_bootother_size);
acquire_spinlock(&kernel_lock);
- for (c = cpu; c < &cpu[ncpu]; c++) {
+ for (c = cpus; c < &cpus[ncpu]; c++) {
if (c == bcpu) continue;
- cprintf ("starting processor %d\n", c - cpu);
- release_grant_spinlock(&kernel_lock, c - cpu);
+ cprintf ("starting processor %d\n", c - cpus);
+ release_grant_spinlock(&kernel_lock, c - cpus);
lapic_startap(c, (uint32_t) KADDR(APBOOTCODE));
acquire_spinlock(&kernel_lock);
- cprintf ("done starting processor %d\n", c - cpu);
+ cprintf ("done starting processor %d\n", c - cpus);
}
}