separate source into kernel/ user/ mkfs/
This commit is contained in:
parent
91ba81110a
commit
5753553213
|
@ -1,6 +0,0 @@
|
|||
set confirm off
|
||||
python
|
||||
gdb.execute("target remote localhost:26000")
|
||||
gdb.execute("set architecture i386")
|
||||
gdb.execute("symbol-file kernel")
|
||||
gdb.execute("break *0x7c00")
|
|
@ -1,4 +1,4 @@
|
|||
set confirm off
|
||||
set architecture riscv
|
||||
target remote 127.0.0.1:1234
|
||||
symbol-file kernel
|
||||
symbol-file kernel/kernel
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
#if you would like to use gdb in 32bit mode, comment out lines 8 and 15, then uncomment
|
||||
#the lines after. Note this will only work properly until 64bit mode is enabled in entry.S
|
||||
|
||||
python
|
||||
gdb.execute("set architecture i386:x86-64:intel")
|
||||
gdb.execute("target remote localhost:26000")
|
||||
gdb.execute("symbol-file kernel")
|
||||
gdb.execute("break start64")
|
||||
#gdb.execute("break *0x7c00")
|
||||
try:
|
||||
gdb.execute("continue")
|
||||
except:
|
||||
pass
|
||||
gdb.execute("disconnect")
|
||||
gdb.execute("set architecture i386:x86-64")
|
||||
#gdb.execute("set architecture i386")
|
||||
gdb.execute("target remote localhost:26000")
|
||||
gdb.execute("delete break 1")
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,7 +10,6 @@ bootblock
|
|||
entryother
|
||||
initcode
|
||||
initcode.out
|
||||
kernel
|
||||
kernelmemfs
|
||||
mkfs
|
||||
.gdbinit
|
||||
|
|
148
Makefile
148
Makefile
|
@ -1,29 +1,33 @@
|
|||
K=kernel
|
||||
U=user
|
||||
|
||||
OBJS = \
|
||||
start.o \
|
||||
console.o \
|
||||
uart.o \
|
||||
kalloc.o \
|
||||
spinlock.o \
|
||||
string.o \
|
||||
main.o \
|
||||
vm.o \
|
||||
proc.o \
|
||||
swtch.o \
|
||||
trampoline.o \
|
||||
trap.o \
|
||||
syscall.o \
|
||||
sysproc.o \
|
||||
bio.o \
|
||||
fs.o \
|
||||
log.o \
|
||||
sleeplock.o \
|
||||
file.o \
|
||||
pipe.o \
|
||||
ramdisk.o \
|
||||
exec.o \
|
||||
sysfile.o \
|
||||
kernelvec.o \
|
||||
plic.o
|
||||
$K/entry.o \
|
||||
$K/start.o \
|
||||
$K/console.o \
|
||||
$K/uart.o \
|
||||
$K/kalloc.o \
|
||||
$K/spinlock.o \
|
||||
$K/string.o \
|
||||
$K/main.o \
|
||||
$K/vm.o \
|
||||
$K/proc.o \
|
||||
$K/swtch.o \
|
||||
$K/trampoline.o \
|
||||
$K/trap.o \
|
||||
$K/syscall.o \
|
||||
$K/sysproc.o \
|
||||
$K/bio.o \
|
||||
$K/fs.o \
|
||||
$K/log.o \
|
||||
$K/sleeplock.o \
|
||||
$K/file.o \
|
||||
$K/pipe.o \
|
||||
$K/ramdisk.o \
|
||||
$K/exec.o \
|
||||
$K/sysfile.o \
|
||||
$K/kernelvec.o \
|
||||
$K/plic.o
|
||||
|
||||
# riscv64-unknown-elf- or riscv64-linux-gnu-
|
||||
# perhaps in /opt/riscv/bin
|
||||
|
@ -53,6 +57,7 @@ OBJDUMP = $(TOOLPREFIX)objdump
|
|||
CFLAGS = -Wall -Werror -O -fno-omit-frame-pointer -ggdb
|
||||
CFLAGS += -mcmodel=medany
|
||||
CFLAGS += -ffreestanding -fno-common -nostdlib -mno-relax
|
||||
CFLAGS += -I.
|
||||
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
|
||||
|
||||
# Disable PIE when possible (for Ubuntu 16.10 toolchain)
|
||||
|
@ -65,41 +70,41 @@ endif
|
|||
|
||||
LDFLAGS = -z max-page-size=4096
|
||||
|
||||
kernel: $(OBJS) entry.o kernel.ld initcode
|
||||
$(LD) $(LDFLAGS) -T kernel.ld -o kernel entry.o $(OBJS)
|
||||
$(OBJDUMP) -S kernel > kernel.asm
|
||||
$(OBJDUMP) -t kernel | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernel.sym
|
||||
$K/kernel: $(OBJS) $K/kernel.ld $U/initcode
|
||||
$(LD) $(LDFLAGS) -T $K/kernel.ld -o $K/kernel $(OBJS)
|
||||
$(OBJDUMP) -S $K/kernel > $K/kernel.asm
|
||||
$(OBJDUMP) -t $K/kernel | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $K/kernel.sym
|
||||
|
||||
initcode: initcode.S
|
||||
$(CC) $(CFLAGS) -nostdinc -I. -c initcode.S
|
||||
$(LD) $(LDFLAGS) -N -e start -Ttext 0 -o initcode.out initcode.o
|
||||
$(OBJCOPY) -S -O binary initcode.out initcode
|
||||
$(OBJDUMP) -S initcode.o > initcode.asm
|
||||
$U/initcode: $U/initcode.S
|
||||
$(CC) $(CFLAGS) -nostdinc -I. -Ikernel -c $U/initcode.S -o $U/initcode.o
|
||||
$(LD) $(LDFLAGS) -N -e start -Ttext 0 -o $U/initcode.out $U/initcode.o
|
||||
$(OBJCOPY) -S -O binary $U/initcode.out $U/initcode
|
||||
$(OBJDUMP) -S $U/initcode.o > $U/initcode.asm
|
||||
|
||||
tags: $(OBJS) entryother.S _init
|
||||
tags: $(OBJS) _init
|
||||
etags *.S *.c
|
||||
|
||||
vectors.S: vectors.pl
|
||||
./vectors.pl > vectors.S
|
||||
|
||||
ULIB = ulib.o usys.o printf.o umalloc.o
|
||||
ULIB = $U/ulib.o $U/usys.o $U/printf.o $U/umalloc.o
|
||||
|
||||
_%: %.o $(ULIB)
|
||||
$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o $@ $^
|
||||
$(OBJDUMP) -S $@ > $*.asm
|
||||
$(OBJDUMP) -t $@ | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $*.sym
|
||||
|
||||
usys.S : usys.pl
|
||||
perl ./usys.pl > usys.S
|
||||
$U/usys.S : $U/usys.pl
|
||||
perl $U/usys.pl > $U/usys.S
|
||||
|
||||
_forktest: forktest.o $(ULIB)
|
||||
$U/usys.o : $U/usys.S
|
||||
$(CC) $(CFLAGS) -c -o $U/usys.o $U/usys.S
|
||||
|
||||
$U/_forktest: $U/forktest.o $(ULIB)
|
||||
# forktest has less library code linked in - needs to be small
|
||||
# in order to be able to max out the proc table.
|
||||
$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o _forktest forktest.o ulib.o usys.o
|
||||
$(OBJDUMP) -S _forktest > forktest.asm
|
||||
$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o $U/_forktest $U/forktest.o $U/ulib.o $U/usys.o
|
||||
$(OBJDUMP) -S $U/_forktest > $U/forktest.asm
|
||||
|
||||
mkfs: mkfs.c fs.h
|
||||
gcc -Werror -Wall -o mkfs mkfs.c
|
||||
mkfs/mkfs: mkfs/mkfs.c $K/fs.h
|
||||
gcc -Werror -Wall -I. -o mkfs/mkfs mkfs/mkfs.c
|
||||
|
||||
# Prevent deletion of intermediate files, e.g. cat.o, after first build, so
|
||||
# that disk image changes after first build are persistent until clean. More
|
||||
|
@ -108,32 +113,33 @@ mkfs: mkfs.c fs.h
|
|||
.PRECIOUS: %.o
|
||||
|
||||
UPROGS=\
|
||||
_cat\
|
||||
_echo\
|
||||
_forktest\
|
||||
_grep\
|
||||
_init\
|
||||
_kill\
|
||||
_ln\
|
||||
_ls\
|
||||
_mkdir\
|
||||
_rm\
|
||||
_sh\
|
||||
_stressfs\
|
||||
_usertests\
|
||||
_wc\
|
||||
_zombie\
|
||||
$U/_cat\
|
||||
$U/_echo\
|
||||
$U/_forktest\
|
||||
$U/_grep\
|
||||
$U/_init\
|
||||
$U/_kill\
|
||||
$U/_ln\
|
||||
$U/_ls\
|
||||
$U/_mkdir\
|
||||
$U/_rm\
|
||||
$U/_sh\
|
||||
$U/_stressfs\
|
||||
$U/_usertests\
|
||||
$U/_wc\
|
||||
$U/_zombie\
|
||||
|
||||
fs.img: mkfs README $(UPROGS)
|
||||
./mkfs fs.img README $(UPROGS)
|
||||
fs.img: mkfs/mkfs README $(UPROGS)
|
||||
mkfs/mkfs fs.img README $(UPROGS)
|
||||
|
||||
-include *.d
|
||||
|
||||
clean:
|
||||
rm -f *.tex *.dvi *.idx *.aux *.log *.ind *.ilg \
|
||||
*.o *.d *.asm *.sym vectors.S bootblock entryother \
|
||||
initcode initcode.out kernel fs.img kernelmemfs \
|
||||
mkfs .gdbinit \
|
||||
*/*.o */*.d */*.asm */*.sym \
|
||||
$U/initcode $U/initcode.out $K/kernel fs.img \
|
||||
mkfs/mkfs .gdbinit \
|
||||
$U/usys.S \
|
||||
$(UPROGS)
|
||||
|
||||
# make a printout
|
||||
|
@ -155,23 +161,19 @@ QEMUGDB = $(shell if $(QEMU) -help | grep -q '^-gdb'; \
|
|||
ifndef CPUS
|
||||
CPUS := 3
|
||||
endif
|
||||
QEMUOPTS = -machine virt -kernel kernel -m 3G -smp $(CPUS) -nographic
|
||||
QEMUOPTS = -machine virt -kernel $K/kernel -m 3G -smp $(CPUS) -nographic
|
||||
QEMUOPTS += -initrd fs.img
|
||||
|
||||
qemu: kernel fs.img
|
||||
qemu: $K/kernel fs.img
|
||||
$(QEMU) $(QEMUOPTS)
|
||||
|
||||
.gdbinit: .gdbinit.tmpl-riscv
|
||||
sed "s/:1234/:$(GDBPORT)/" < $^ > $@
|
||||
|
||||
qemu-gdb: kernel .gdbinit fs.img
|
||||
qemu-gdb: $K/kernel .gdbinit fs.img
|
||||
@echo "*** Now run 'gdb'." 1>&2
|
||||
$(QEMU) $(QEMUOPTS) -S $(QEMUGDB)
|
||||
|
||||
qemu-nox-gdb: fs.img kernel .gdbinit
|
||||
@echo "*** Now run 'gdb'." 1>&2
|
||||
$(QEMU) -nographic $(QEMUOPTS) -S $(QEMUGDB)
|
||||
|
||||
# CUT HERE
|
||||
# prepare dist for students
|
||||
# after running make dist, probably want to
|
||||
|
|
76
ioapic.c
76
ioapic.c
|
@ -1,76 +0,0 @@
|
|||
// The I/O APIC manages hardware interrupts for an SMP system.
|
||||
// http://www.intel.com/design/chipsets/datashts/29056601.pdf
|
||||
// See also picirq.c.
|
||||
|
||||
#include "types.h"
|
||||
#include "defs.h"
|
||||
#include "memlayout.h"
|
||||
#include "traps.h"
|
||||
|
||||
#define IOAPIC 0xFEC00000 // Default physical address of IO APIC
|
||||
|
||||
#define REG_ID 0x00 // Register index: ID
|
||||
#define REG_VER 0x01 // Register index: version
|
||||
#define REG_TABLE 0x10 // Redirection table base
|
||||
|
||||
// The redirection table starts at REG_TABLE and uses
|
||||
// two registers to configure each interrupt.
|
||||
// The first (low) register in a pair contains configuration bits.
|
||||
// The second (high) register contains a bitmask telling which
|
||||
// CPUs can serve that interrupt.
|
||||
#define INT_DISABLED 0x00010000 // Interrupt disabled
|
||||
#define INT_LEVEL 0x00008000 // Level-triggered (vs edge-)
|
||||
#define INT_ACTIVELOW 0x00002000 // Active low (vs high)
|
||||
#define INT_LOGICAL 0x00000800 // Destination is CPU id (vs APIC ID)
|
||||
|
||||
volatile struct ioapic *ioapic;
|
||||
|
||||
// IO APIC MMIO structure: write reg, then read or write data.
|
||||
struct ioapic {
|
||||
uint reg;
|
||||
uint pad[3];
|
||||
uint data;
|
||||
};
|
||||
|
||||
static uint
|
||||
ioapicread(int reg)
|
||||
{
|
||||
ioapic->reg = reg;
|
||||
return ioapic->data;
|
||||
}
|
||||
|
||||
static void
|
||||
ioapicwrite(int reg, uint data)
|
||||
{
|
||||
ioapic->reg = reg;
|
||||
ioapic->data = data;
|
||||
}
|
||||
|
||||
void
|
||||
ioapicinit(void)
|
||||
{
|
||||
int i, id, maxintr;
|
||||
|
||||
ioapic = P2V((volatile struct ioapic*)IOAPIC);
|
||||
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
|
||||
id = ioapicread(REG_ID) >> 24;
|
||||
if(id != ioapicid)
|
||||
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
|
||||
|
||||
// Mark all interrupts edge-triggered, active high, disabled,
|
||||
// and not routed to any CPUs.
|
||||
for(i = 0; i <= maxintr; i++){
|
||||
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
|
||||
ioapicwrite(REG_TABLE+2*i+1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ioapicenable(int irq, int cpunum)
|
||||
{
|
||||
// Mark interrupt edge-triggered, active high,
|
||||
// enabled, and routed to the given cpunum,
|
||||
// which happens to be that cpu's APIC ID.
|
||||
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
|
||||
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
|
||||
}
|
|
@ -6,10 +6,10 @@
|
|||
#include <assert.h>
|
||||
|
||||
#define stat xv6_stat // avoid clash with host struct stat
|
||||
#include "types.h"
|
||||
#include "fs.h"
|
||||
#include "stat.h"
|
||||
#include "param.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/fs.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "kernel/param.h"
|
||||
|
||||
#ifndef static_assert
|
||||
#define static_assert(a, b) do { switch (0) case 0: case (a): ; } while (0)
|
||||
|
@ -129,7 +129,14 @@ main(int argc, char *argv[])
|
|||
iappend(rootino, &de, sizeof(de));
|
||||
|
||||
for(i = 2; i < argc; i++){
|
||||
assert(index(argv[i], '/') == 0);
|
||||
// get rid of "user/"
|
||||
char *shortname;
|
||||
if(strncmp(argv[i], "user/", 5) == 0)
|
||||
shortname = argv[i] + 5;
|
||||
else
|
||||
shortname = argv[i];
|
||||
|
||||
assert(index(shortname, '/') == 0);
|
||||
|
||||
if((fd = open(argv[i], 0)) < 0){
|
||||
perror(argv[i]);
|
||||
|
@ -140,14 +147,14 @@ main(int argc, char *argv[])
|
|||
// The binaries are named _rm, _cat, etc. to keep the
|
||||
// build operating system from trying to execute them
|
||||
// in place of system binaries like rm and cat.
|
||||
if(argv[i][0] == '_')
|
||||
++argv[i];
|
||||
if(shortname[0] == '_')
|
||||
shortname += 1;
|
||||
|
||||
inum = ialloc(T_FILE);
|
||||
|
||||
bzero(&de, sizeof(de));
|
||||
de.inum = xshort(inum);
|
||||
strncpy(de.name, argv[i], DIRSIZ);
|
||||
strncpy(de.name, shortname, DIRSIZ);
|
||||
iappend(rootino, &de, sizeof(de));
|
||||
|
||||
while((cc = read(fd, buf, sizeof(buf))) > 0)
|
|
@ -1,6 +1,6 @@
|
|||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
|
||||
char buf[512];
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
|
@ -1,9 +1,9 @@
|
|||
// Test that fork fails gracefully.
|
||||
// Tiny executable so that the limit can be filling the proc table.
|
||||
|
||||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
|
||||
#define N 1000
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
// Simple grep. Only supports ^ . * $ operators.
|
||||
|
||||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
|
||||
char buf[1024];
|
||||
int match(char*, char*);
|
|
@ -1,9 +1,9 @@
|
|||
// init: The initial user-level program
|
||||
|
||||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "fcntl.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
#include "kernel/fcntl.h"
|
||||
|
||||
char *argv[] = { "sh", 0 };
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
|
@ -1,6 +1,6 @@
|
|||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
|
@ -1,7 +1,7 @@
|
|||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "fs.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
#include "kernel/fs.h"
|
||||
|
||||
char*
|
||||
fmtname(char *path)
|
|
@ -1,6 +1,6 @@
|
|||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
|
@ -1,6 +1,6 @@
|
|||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
|
@ -1,8 +1,8 @@
|
|||
// Shell.
|
||||
|
||||
#include "types.h"
|
||||
#include "user.h"
|
||||
#include "fcntl.h"
|
||||
#include "kernel/types.h"
|
||||
#include "user/user.h"
|
||||
#include "kernel/fcntl.h"
|
||||
|
||||
// Parsed command representation
|
||||
#define EXEC 1
|
|
@ -7,11 +7,11 @@
|
|||
// for (i = 0; i < 40000; i++)
|
||||
// asm volatile("");
|
||||
|
||||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "fs.h"
|
||||
#include "fcntl.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
#include "kernel/fs.h"
|
||||
#include "kernel/fcntl.h"
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
|
@ -1,7 +1,7 @@
|
|||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "fcntl.h"
|
||||
#include "user.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "kernel/fcntl.h"
|
||||
#include "user/user.h"
|
||||
|
||||
char*
|
||||
strcpy(char *s, const char *t)
|
|
@ -1,7 +1,7 @@
|
|||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "param.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
#include "kernel/param.h"
|
||||
|
||||
// Memory allocator by Kernighan and Ritchie,
|
||||
// The C programming Language, 2nd ed. Section 8.7.
|
|
@ -1,11 +1,11 @@
|
|||
#include "param.h"
|
||||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "fs.h"
|
||||
#include "fcntl.h"
|
||||
#include "syscall.h"
|
||||
#include "memlayout.h"
|
||||
#include "kernel/param.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
#include "kernel/fs.h"
|
||||
#include "kernel/fcntl.h"
|
||||
#include "kernel/syscall.h"
|
||||
#include "kernel/memlayout.h"
|
||||
|
||||
char buf[8192];
|
||||
char name[3];
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
print "# generated by usys.pl - do not edit\n";
|
||||
|
||||
print "#include \"syscall.h\"\n";
|
||||
print "#include \"kernel/syscall.h\"\n";
|
||||
|
||||
sub entry {
|
||||
my $name = shift;
|
|
@ -1,6 +1,6 @@
|
|||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
|
||||
char buf[512];
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
// Create a zombie process that
|
||||
// must be reparented at exit.
|
||||
|
||||
#include "types.h"
|
||||
#include "stat.h"
|
||||
#include "user.h"
|
||||
#include "kernel/types.h"
|
||||
#include "kernel/stat.h"
|
||||
#include "user/user.h"
|
||||
|
||||
int
|
||||
main(void)
|
47
vectors.pl
47
vectors.pl
|
@ -1,47 +0,0 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# Generate vectors.S, the trap/interrupt entry points.
|
||||
# There has to be one entry point per interrupt number
|
||||
# since otherwise there's no way for trap() to discover
|
||||
# the interrupt number.
|
||||
|
||||
print "# generated by vectors.pl - do not edit\n";
|
||||
print "# handlers\n";
|
||||
print ".globl alltraps\n";
|
||||
for(my $i = 0; $i < 256; $i++){
|
||||
print ".globl vector$i\n";
|
||||
print "vector$i:\n";
|
||||
if(!($i == 8 || ($i >= 10 && $i <= 14) || $i == 17)){
|
||||
print " push \$0\n";
|
||||
}
|
||||
print " push \$$i\n";
|
||||
print " jmp alltraps\n";
|
||||
}
|
||||
|
||||
print "\n# vector table\n";
|
||||
print ".data\n";
|
||||
print ".globl vectors\n";
|
||||
print "vectors:\n";
|
||||
for(my $i = 0; $i < 256; $i++){
|
||||
print " .quad vector$i\n";
|
||||
}
|
||||
|
||||
# sample output:
|
||||
# # handlers
|
||||
# .globl alltraps
|
||||
# .globl vector0
|
||||
# vector0:
|
||||
# push $0
|
||||
# push $0
|
||||
# jmp alltraps
|
||||
# ...
|
||||
#
|
||||
# # vector table
|
||||
# .data
|
||||
# .globl vectors
|
||||
# vectors:
|
||||
# .quad vector0
|
||||
# .quad vector1
|
||||
# .quad vector2
|
||||
# ...
|
||||
|
Loading…
Reference in a new issue