if(!(ip->flags & I_VALID)){
bp = bread(ip->dev, IBLOCK(ip->inum));
- dip = &((struct dinode*)(bp->data))[ip->inum % IPB];
+ dip = (struct dinode*)bp->data + ip->inum%IPB;
ip->type = dip->type;
ip->major = dip->major;
ip->minor = dip->minor;
readsb(dev, &sb);
for(inum = 1; inum < sb.ninodes; inum++) { // loop over inode blocks
bp = bread(dev, IBLOCK(inum));
- dip = (struct dinode*)(bp->data) + inum%IPB;
+ dip = (struct dinode*)bp->data + inum%IPB;
if(dip->type == 0) { // a free inode
memset(dip, 0, sizeof(*dip));
dip->type = type;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum));
- dip = (struct dinode*)(bp->data) + ip->inum%IPB;
+ dip = (struct dinode*)bp->data + ip->inum%IPB;
dip->type = ip->type;
dip->major = ip->major;
dip->minor = ip->minor;
#include "proc.h"
#include "x86.h"
-extern char edata[], end[];
-
-void bootothers(void);
+static void bootothers(void);
// Bootstrap processor starts running C code here.
int
{
int i;
static volatile int bcpu; // cannot be on stack
+ extern char edata[], end[];
// clear BSS
memset(edata, 0, end - edata);
idtinit();
lapic_init(cpu());
setupsegs(0);
-
cpuid(0, 0, 0, 0, 0); // memory barrier
cpus[cpu()].booted = 1;
scheduler();
}
-void
+static void
bootothers(void)
{
extern uchar _binary_bootother_start[], _binary_bootother_size[];
if(c == cpus+cpu()) // We've started already.
continue;
- // Set target %esp, %eip
+ // Fill in %esp, %eip and start code on cpu.
*(void**)(code-4) = c->mpstack + MPSTACK;
*(void**)(code-8) = mpmain;
lapic_startap(c->apicid, (uint)code);