2006-07-16 17:35:18 +02:00
|
|
|
OBJS = \
|
|
|
|
console.o\
|
|
|
|
fd.o\
|
|
|
|
ide.o\
|
|
|
|
kalloc.o\
|
|
|
|
lapic.o\
|
2006-08-04 20:12:31 +02:00
|
|
|
ioapic.o\
|
2006-07-16 17:35:18 +02:00
|
|
|
main.o\
|
|
|
|
mp.o\
|
|
|
|
picirq.o\
|
|
|
|
pipe.o\
|
|
|
|
proc.o\
|
|
|
|
setjmp.o\
|
|
|
|
spinlock.o\
|
|
|
|
string.o\
|
|
|
|
syscall.o\
|
2006-09-06 20:18:43 +02:00
|
|
|
sysfile.o\
|
|
|
|
sysproc.o\
|
2006-07-16 17:35:18 +02:00
|
|
|
trapasm.o\
|
|
|
|
trap.o\
|
|
|
|
vectors.o\
|
2006-07-21 15:18:04 +02:00
|
|
|
bio.o\
|
|
|
|
fs.o\
|
2006-06-12 17:22:12 +02:00
|
|
|
|
Changes to allow use of native x86 ELF compilers, which on my
Linux 2.4 box using gcc 3.4.6 don't seem to follow the same
conventions as the i386-jos-elf-gcc compilers.
Can run make 'TOOLPREFIX=' or edit the Makefile.
curproc[cpu()] can now be NULL, indicating that no proc is running.
This seemed safer to me than having curproc[0] and curproc[1]
both pointing at proc[0] potentially.
The old implementation of swtch depended on the stack frame layout
used inside swtch being okay to return from on the other stack
(exactly the V6 you are not expected to understand this).
It also could be called in two contexts: at boot time, to schedule
the very first process, and later, on behalf of a process, to sleep
or schedule some other process.
I split this into two functions: scheduler and swtch.
The scheduler is now a separate never-returning function, invoked
by each cpu once set up. The scheduler looks like:
scheduler() {
setjmp(cpu.context);
pick proc to schedule
blah blah blah
longjmp(proc.context)
}
The new swtch is intended to be called only when curproc[cpu()] is not NULL,
that is, only on behalf of a user proc. It does:
swtch() {
if(setjmp(proc.context) == 0)
longjmp(cpu.context)
}
to save the current proc context and then jump over to the scheduler,
running on the cpu stack.
Similarly the system call stubs are now in assembly in usys.S to avoid
needing to know the details of stack frame layout used by the compiler.
Also various changes in the debugging prints.
2006-07-11 03:07:40 +02:00
|
|
|
# Cross-compiling (e.g., on Mac OS X)
|
|
|
|
TOOLPREFIX = i386-jos-elf-
|
|
|
|
|
|
|
|
# Using native tools (e.g., on X86 Linux)
|
|
|
|
# TOOLPREFIX =
|
|
|
|
|
|
|
|
CC = $(TOOLPREFIX)gcc
|
|
|
|
LD = $(TOOLPREFIX)ld
|
|
|
|
OBJCOPY = $(TOOLPREFIX)objcopy
|
|
|
|
OBJDUMP = $(TOOLPREFIX)objdump
|
2006-07-17 03:51:47 +02:00
|
|
|
CFLAGS = -fno-builtin -O2 -Wall -MD
|
Changes to allow use of native x86 ELF compilers, which on my
Linux 2.4 box using gcc 3.4.6 don't seem to follow the same
conventions as the i386-jos-elf-gcc compilers.
Can run make 'TOOLPREFIX=' or edit the Makefile.
curproc[cpu()] can now be NULL, indicating that no proc is running.
This seemed safer to me than having curproc[0] and curproc[1]
both pointing at proc[0] potentially.
The old implementation of swtch depended on the stack frame layout
used inside swtch being okay to return from on the other stack
(exactly the V6 you are not expected to understand this).
It also could be called in two contexts: at boot time, to schedule
the very first process, and later, on behalf of a process, to sleep
or schedule some other process.
I split this into two functions: scheduler and swtch.
The scheduler is now a separate never-returning function, invoked
by each cpu once set up. The scheduler looks like:
scheduler() {
setjmp(cpu.context);
pick proc to schedule
blah blah blah
longjmp(proc.context)
}
The new swtch is intended to be called only when curproc[cpu()] is not NULL,
that is, only on behalf of a user proc. It does:
swtch() {
if(setjmp(proc.context) == 0)
longjmp(cpu.context)
}
to save the current proc context and then jump over to the scheduler,
running on the cpu stack.
Similarly the system call stubs are now in assembly in usys.S to avoid
needing to know the details of stack frame layout used by the compiler.
Also various changes in the debugging prints.
2006-07-11 03:07:40 +02:00
|
|
|
AS = $(TOOLPREFIX)gas
|
2006-06-12 17:22:12 +02:00
|
|
|
|
2006-07-21 15:18:04 +02:00
|
|
|
xv6.img : bootblock kernel fs.img
|
2006-06-12 17:22:12 +02:00
|
|
|
dd if=/dev/zero of=xv6.img count=10000
|
|
|
|
dd if=bootblock of=xv6.img conv=notrunc
|
|
|
|
dd if=kernel of=xv6.img seek=1 conv=notrunc
|
|
|
|
|
|
|
|
bootblock : bootasm.S bootmain.c
|
|
|
|
$(CC) -O -nostdinc -I. -c bootmain.c
|
|
|
|
$(CC) -nostdinc -I. -c bootasm.S
|
|
|
|
$(LD) -N -e start -Ttext 0x7C00 -o bootblock.o bootasm.o bootmain.o
|
|
|
|
$(OBJDUMP) -S bootblock.o > bootblock.asm
|
|
|
|
$(OBJCOPY) -S -O binary bootblock.o bootblock
|
|
|
|
./sign.pl bootblock
|
|
|
|
|
2006-08-16 03:56:00 +02:00
|
|
|
kernel : $(OBJS) bootother.S init
|
2006-06-22 03:28:57 +02:00
|
|
|
$(CC) -nostdinc -I. -c bootother.S
|
|
|
|
$(LD) -N -e start -Ttext 0x7000 -o bootother.out bootother.o
|
|
|
|
$(OBJCOPY) -S -O binary bootother.out bootother
|
|
|
|
$(OBJDUMP) -S bootother.o > bootother.asm
|
2006-08-16 03:56:00 +02:00
|
|
|
$(LD) -Ttext 0x100000 -e main0 -o kernel $(OBJS) -b binary bootother init
|
2006-06-12 17:22:12 +02:00
|
|
|
$(OBJDUMP) -S kernel > kernel.asm
|
|
|
|
|
2006-08-28 20:31:33 +02:00
|
|
|
tags: $(OBJS) bootother.S init
|
|
|
|
etags *.S *.c
|
|
|
|
|
2006-08-29 19:50:19 +02:00
|
|
|
PRINT = \
|
2006-09-05 17:50:55 +02:00
|
|
|
runoff.list \
|
2006-08-29 19:50:19 +02:00
|
|
|
README\
|
2006-08-28 20:31:33 +02:00
|
|
|
types.h param.h defs.h x86.h asm.h elf.h mmu.h spinlock.h\
|
|
|
|
bootasm.S bootother.S main.c init.c spinlock.c\
|
|
|
|
proc.h proc.c setjmp.S kalloc.c\
|
|
|
|
syscall.h trapasm.S traps.h trap.c vectors.pl syscall.c\
|
|
|
|
buf.h dev.h fcntl.h stat.h fd.h fs.h fsvar.h fd.c fs.c bio.c ide.c\
|
|
|
|
pipe.c\
|
|
|
|
mp.h ioapic.h mp.c lapic.c ioapic.c picirq.c\
|
|
|
|
console.c\
|
|
|
|
string.c\
|
|
|
|
|
2006-09-05 17:50:55 +02:00
|
|
|
# make a printout
|
|
|
|
xv6.pdf : $(PRINT)
|
|
|
|
./runoff
|
|
|
|
|
|
|
|
print : xv6.pdf
|
2006-08-28 20:31:33 +02:00
|
|
|
|
2006-06-13 17:50:06 +02:00
|
|
|
vectors.S : vectors.pl
|
|
|
|
perl vectors.pl > vectors.S
|
|
|
|
|
2006-08-24 04:44:41 +02:00
|
|
|
ULIB = ulib.o usys.o printf.o umalloc.o
|
Changes to allow use of native x86 ELF compilers, which on my
Linux 2.4 box using gcc 3.4.6 don't seem to follow the same
conventions as the i386-jos-elf-gcc compilers.
Can run make 'TOOLPREFIX=' or edit the Makefile.
curproc[cpu()] can now be NULL, indicating that no proc is running.
This seemed safer to me than having curproc[0] and curproc[1]
both pointing at proc[0] potentially.
The old implementation of swtch depended on the stack frame layout
used inside swtch being okay to return from on the other stack
(exactly the V6 you are not expected to understand this).
It also could be called in two contexts: at boot time, to schedule
the very first process, and later, on behalf of a process, to sleep
or schedule some other process.
I split this into two functions: scheduler and swtch.
The scheduler is now a separate never-returning function, invoked
by each cpu once set up. The scheduler looks like:
scheduler() {
setjmp(cpu.context);
pick proc to schedule
blah blah blah
longjmp(proc.context)
}
The new swtch is intended to be called only when curproc[cpu()] is not NULL,
that is, only on behalf of a user proc. It does:
swtch() {
if(setjmp(proc.context) == 0)
longjmp(cpu.context)
}
to save the current proc context and then jump over to the scheduler,
running on the cpu stack.
Similarly the system call stubs are now in assembly in usys.S to avoid
needing to know the details of stack frame layout used by the compiler.
Also various changes in the debugging prints.
2006-07-11 03:07:40 +02:00
|
|
|
|
2006-07-16 17:35:18 +02:00
|
|
|
user1 : user1.o $(ULIB)
|
Changes to allow use of native x86 ELF compilers, which on my
Linux 2.4 box using gcc 3.4.6 don't seem to follow the same
conventions as the i386-jos-elf-gcc compilers.
Can run make 'TOOLPREFIX=' or edit the Makefile.
curproc[cpu()] can now be NULL, indicating that no proc is running.
This seemed safer to me than having curproc[0] and curproc[1]
both pointing at proc[0] potentially.
The old implementation of swtch depended on the stack frame layout
used inside swtch being okay to return from on the other stack
(exactly the V6 you are not expected to understand this).
It also could be called in two contexts: at boot time, to schedule
the very first process, and later, on behalf of a process, to sleep
or schedule some other process.
I split this into two functions: scheduler and swtch.
The scheduler is now a separate never-returning function, invoked
by each cpu once set up. The scheduler looks like:
scheduler() {
setjmp(cpu.context);
pick proc to schedule
blah blah blah
longjmp(proc.context)
}
The new swtch is intended to be called only when curproc[cpu()] is not NULL,
that is, only on behalf of a user proc. It does:
swtch() {
if(setjmp(proc.context) == 0)
longjmp(cpu.context)
}
to save the current proc context and then jump over to the scheduler,
running on the cpu stack.
Similarly the system call stubs are now in assembly in usys.S to avoid
needing to know the details of stack frame layout used by the compiler.
Also various changes in the debugging prints.
2006-07-11 03:07:40 +02:00
|
|
|
$(LD) -N -e main -Ttext 0 -o user1 user1.o $(ULIB)
|
2006-06-26 17:11:19 +02:00
|
|
|
$(OBJDUMP) -S user1 > user1.asm
|
2006-06-22 22:47:23 +02:00
|
|
|
|
2006-07-16 17:35:18 +02:00
|
|
|
usertests : usertests.o $(ULIB)
|
Changes to allow use of native x86 ELF compilers, which on my
Linux 2.4 box using gcc 3.4.6 don't seem to follow the same
conventions as the i386-jos-elf-gcc compilers.
Can run make 'TOOLPREFIX=' or edit the Makefile.
curproc[cpu()] can now be NULL, indicating that no proc is running.
This seemed safer to me than having curproc[0] and curproc[1]
both pointing at proc[0] potentially.
The old implementation of swtch depended on the stack frame layout
used inside swtch being okay to return from on the other stack
(exactly the V6 you are not expected to understand this).
It also could be called in two contexts: at boot time, to schedule
the very first process, and later, on behalf of a process, to sleep
or schedule some other process.
I split this into two functions: scheduler and swtch.
The scheduler is now a separate never-returning function, invoked
by each cpu once set up. The scheduler looks like:
scheduler() {
setjmp(cpu.context);
pick proc to schedule
blah blah blah
longjmp(proc.context)
}
The new swtch is intended to be called only when curproc[cpu()] is not NULL,
that is, only on behalf of a user proc. It does:
swtch() {
if(setjmp(proc.context) == 0)
longjmp(cpu.context)
}
to save the current proc context and then jump over to the scheduler,
running on the cpu stack.
Similarly the system call stubs are now in assembly in usys.S to avoid
needing to know the details of stack frame layout used by the compiler.
Also various changes in the debugging prints.
2006-07-11 03:07:40 +02:00
|
|
|
$(LD) -N -e main -Ttext 0 -o usertests usertests.o $(ULIB)
|
2006-06-27 16:35:53 +02:00
|
|
|
$(OBJDUMP) -S usertests > usertests.asm
|
|
|
|
|
2006-08-16 00:18:20 +02:00
|
|
|
fstests : fstests.o $(ULIB)
|
|
|
|
$(LD) -N -e main -Ttext 0 -o fstests fstests.o $(ULIB)
|
|
|
|
$(OBJDUMP) -S fstests > fstests.asm
|
|
|
|
|
2006-07-29 00:33:07 +02:00
|
|
|
echo : echo.o $(ULIB)
|
|
|
|
$(LD) -N -e main -Ttext 0 -o echo echo.o $(ULIB)
|
|
|
|
$(OBJDUMP) -S echo > echo.asm
|
|
|
|
|
2006-08-08 21:58:06 +02:00
|
|
|
cat : cat.o $(ULIB)
|
|
|
|
$(LD) -N -e main -Ttext 0 -o cat cat.o $(ULIB)
|
|
|
|
$(OBJDUMP) -S cat > cat.asm
|
|
|
|
|
2006-07-16 17:35:18 +02:00
|
|
|
userfs : userfs.o $(ULIB)
|
Changes to allow use of native x86 ELF compilers, which on my
Linux 2.4 box using gcc 3.4.6 don't seem to follow the same
conventions as the i386-jos-elf-gcc compilers.
Can run make 'TOOLPREFIX=' or edit the Makefile.
curproc[cpu()] can now be NULL, indicating that no proc is running.
This seemed safer to me than having curproc[0] and curproc[1]
both pointing at proc[0] potentially.
The old implementation of swtch depended on the stack frame layout
used inside swtch being okay to return from on the other stack
(exactly the V6 you are not expected to understand this).
It also could be called in two contexts: at boot time, to schedule
the very first process, and later, on behalf of a process, to sleep
or schedule some other process.
I split this into two functions: scheduler and swtch.
The scheduler is now a separate never-returning function, invoked
by each cpu once set up. The scheduler looks like:
scheduler() {
setjmp(cpu.context);
pick proc to schedule
blah blah blah
longjmp(proc.context)
}
The new swtch is intended to be called only when curproc[cpu()] is not NULL,
that is, only on behalf of a user proc. It does:
swtch() {
if(setjmp(proc.context) == 0)
longjmp(cpu.context)
}
to save the current proc context and then jump over to the scheduler,
running on the cpu stack.
Similarly the system call stubs are now in assembly in usys.S to avoid
needing to know the details of stack frame layout used by the compiler.
Also various changes in the debugging prints.
2006-07-11 03:07:40 +02:00
|
|
|
$(LD) -N -e main -Ttext 0 -o userfs userfs.o $(ULIB)
|
2006-07-06 23:47:22 +02:00
|
|
|
$(OBJDUMP) -S userfs > userfs.asm
|
|
|
|
|
2006-08-11 15:55:18 +02:00
|
|
|
init : init.o $(ULIB)
|
|
|
|
$(LD) -N -e main -Ttext 0 -o init init.o $(ULIB)
|
|
|
|
$(OBJDUMP) -S init > init.asm
|
|
|
|
|
|
|
|
sh : sh.o $(ULIB)
|
|
|
|
$(LD) -N -e main -Ttext 0 -o sh sh.o $(ULIB)
|
|
|
|
$(OBJDUMP) -S sh > sh.asm
|
|
|
|
|
2006-08-12 06:33:50 +02:00
|
|
|
ls : ls.o $(ULIB)
|
|
|
|
$(LD) -N -e main -Ttext 0 -o ls ls.o $(ULIB)
|
|
|
|
$(OBJDUMP) -S ls > ls.asm
|
|
|
|
|
2006-08-14 23:22:13 +02:00
|
|
|
mkdir : mkdir.o $(ULIB)
|
|
|
|
$(LD) -N -e main -Ttext 0 -o mkdir mkdir.o $(ULIB)
|
|
|
|
$(OBJDUMP) -S mkdir > mkdir.asm
|
|
|
|
|
|
|
|
rm : rm.o $(ULIB)
|
|
|
|
$(LD) -N -e main -Ttext 0 -o rm rm.o $(ULIB)
|
|
|
|
$(OBJDUMP) -S rm > rm.asm
|
|
|
|
|
2006-07-21 15:18:04 +02:00
|
|
|
mkfs : mkfs.c fs.h
|
|
|
|
cc -o mkfs mkfs.c
|
|
|
|
|
2006-09-06 03:25:41 +02:00
|
|
|
fs.img : mkfs userfs usertests echo cat README init sh ls mkdir rm fstests
|
|
|
|
./mkfs fs.img userfs usertests echo cat README init sh ls mkdir rm fstests
|
2006-07-21 15:18:04 +02:00
|
|
|
|
2006-06-15 21:58:01 +02:00
|
|
|
-include *.d
|
|
|
|
|
2006-06-12 17:22:12 +02:00
|
|
|
clean :
|
2006-09-06 20:18:43 +02:00
|
|
|
/bin/rm -f rm
|
2006-09-03 16:38:10 +02:00
|
|
|
rm -f *.ps *.tex *.dvi *.idx *.aux *.log *.ind *.ilg \
|
2006-08-29 19:50:19 +02:00
|
|
|
*.o *.d *.asm vectors.S parport.out \
|
|
|
|
bootblock kernel xv6.img user1 userfs usertests \
|
|
|
|
fs.img mkfs echo init fstests
|