提交 f336c8cd 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

nearly-complete c++ conversion

上级 b2705655
...@@ -21,12 +21,10 @@ ...@@ -21,12 +21,10 @@
// * B_DIRTY: the buffer data has been modified // * B_DIRTY: the buffer data has been modified
// and needs to be written to disk. // and needs to be written to disk.
extern "C" {
#include "types.h" #include "types.h"
#include "kernel.h" #include "kernel.hh"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
}
#include "buf.hh" #include "buf.hh"
#include "cpputil.hh" #include "cpputil.hh"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "spinlock.h" #include "spinlock.h"
#include "kalloc.h" #include "kalloc.h"
#include "syscall.h" #include "syscall.h"
#include "kernel.h" #include "kern_c.h"
/* /*
* Data structures that use C99 designated initializers, * Data structures that use C99 designated initializers,
......
extern "C" {
#include "types.h" #include "types.h"
#include "kernel.h" #include "kernel.hh"
#include "amd64.h" #include "amd64.h"
}
#define BACKSPACE 0x100 #define BACKSPACE 0x100
#define CRTPORT 0x3d4 #define CRTPORT 0x3d4
......
extern "C" {
#include "types.h" #include "types.h"
#include "amd64.h" #include "amd64.h"
#include "mmu.h" #include "mmu.h"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "queue.h" #include "queue.h"
#include "proc.h" #include "proc.hh"
#include "kernel.h" #include "kernel.hh"
#include "cpu.h" #include "cpu.hh"
}
struct spinlock tickslock __mpalign__; struct spinlock tickslock __mpalign__;
struct condvar cv_ticks __mpalign__; struct condvar cv_ticks __mpalign__;
......
...@@ -2,27 +2,21 @@ ...@@ -2,27 +2,21 @@
// Input is from the keyboard or serial port. // Input is from the keyboard or serial port.
// Output is written to the screen and serial port. // Output is written to the screen and serial port.
extern "C" {
#include "types.h" #include "types.h"
#include "cpu.h" #include "cpu.hh"
#include "kernel.h" #include "kernel.hh"
#include "spinlock.h" #include "spinlock.h"
#include "fs.h" #include "fs.h"
#include "condvar.h" #include "condvar.hh"
}
#include "file.hh" #include "file.hh"
extern "C" {
#include "amd64.h" #include "amd64.h"
#include "queue.h" #include "queue.h"
#include "proc.h" #include "proc.hh"
#include "traps.h" #include "traps.h"
#include "lib.h" #include "lib.h"
#include <stdarg.h> #include <stdarg.h>
#include "fmt.h" #include "fmt.hh"
#include <stddef.h> #include <stddef.h>
}
#define BACKSPACE 0x100 #define BACKSPACE 0x100
......
extern "C" {
#include "types.h" #include "types.h"
#include "kernel.h" #include "kernel.hh"
}
#include "cpputil.hh" #include "cpputil.hh"
void * void *
......
extern "C" {
#include "types.h" #include "types.h"
#include "kernel.h" #include "kernel.hh"
#include "mmu.h" #include "mmu.h"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "queue.h" #include "queue.h"
#include "proc.h" #include "proc.hh"
#include "cpu.h" #include "cpu.hh"
}
#include "gc.hh" #include "gc.hh"
#include "crange.hh" #include "crange.hh"
#include "cpputil.hh" #include "cpputil.hh"
...@@ -110,7 +108,7 @@ void range::dec_ref(void) ...@@ -110,7 +108,7 @@ void range::dec_ref(void)
} }
} }
range::range(crange *crarg, u64 k, u64 sz, void *v, markptr<range> n, int nl) range::range(crange *crarg, u64 k, u64 sz, void *v, range *n, int nl)
: rcu_freed("range_delayed") : rcu_freed("range_delayed")
{ {
dprintf("range:range:: %lu %lu %d\n", k, sz, nl); dprintf("range:range:: %lu %lu %d\n", k, sz, nl);
...@@ -227,10 +225,12 @@ static range *replace(u64 k, u64 sz, void *v, range *f, range *l, range *s) ...@@ -227,10 +225,12 @@ static range *replace(u64 k, u64 sz, void *v, range *f, range *l, range *s)
r = left; r = left;
} else if (k <= f->key) { // cut front? } else if (k <= f->key) { // cut front?
assert(k+sz <= f->key + f->size); assert(k+sz <= f->key + f->size);
r = new range(f->cr, k+sz, f->key + f->size - k - sz, v, f->next[0]); assert(!f->next[0].mark());
r = new range(f->cr, k+sz, f->key + f->size - k - sz, v, f->next[0].ptr());
} else { // cut end } else { // cut end
assert(k > f->key); assert(k > f->key);
r = new range(f->cr, f->key, k - f->key, v, f->next[0]); assert(!f->next[0].mark());
r = new range(f->cr, f->key, k - f->key, v, f->next[0].ptr());
} }
} }
} else if (k <= f->key && k + sz >= l->key + l->size) { // delete complete range? } else if (k <= f->key && k + sz >= l->key + l->size) { // delete complete range?
...@@ -383,7 +383,7 @@ void crange::add_index(int l, range *e, range *p1, markptr<range> s1) ...@@ -383,7 +383,7 @@ void crange::add_index(int l, range *e, range *p1, markptr<range> s1)
if (cmpxch(&e->curlevel, l, l+1)) { if (cmpxch(&e->curlevel, l, l+1)) {
assert(e->curlevel < e->nlevel); assert(e->curlevel < e->nlevel);
// this is the core inserting at level l+1, but some core may be deleting // this is the core inserting at level l+1, but some core may be deleting
struct range *s = s1.ptr(); struct range *s = s1.ptr(); // XXX losing the mark bit ???
do { do {
markptr<range> n = e->next[l+1]; // Null and perhaps marked markptr<range> n = e->next[l+1]; // Null and perhaps marked
if (n.mark()) { if (n.mark()) {
......
...@@ -93,7 +93,7 @@ struct range : public rcu_freed { ...@@ -93,7 +93,7 @@ struct range : public rcu_freed {
markptr<range>* next; // one next pointer per level markptr<range>* next; // one next pointer per level
spinlock *lock; // on separate cache line? spinlock *lock; // on separate cache line?
range(crange *cr, u64 k, u64 sz, void *v, markptr<range> n, int nlevel = 0); range(crange *cr, u64 k, u64 sz, void *v, range *n, int nlevel = 0);
~range(); ~range();
virtual void do_gc() { virtual void do_gc() {
delete this; delete this;
......
extern "C" {
#include "types.h" #include "types.h"
#include "amd64.h" #include "amd64.h"
#include "kernel.h" #include "kernel.hh"
#include "pci.h" #include "pci.hh"
#include "spinlock.h" #include "spinlock.h"
#include "e1000reg.h" #include "e1000reg.hh"
}
#define TX_RING_SIZE 64 #define TX_RING_SIZE 64
#define RX_RING_SIZE 64 #define RX_RING_SIZE 64
......
extern "C" {
#include "types.h" #include "types.h"
#include "mmu.h" #include "mmu.h"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "queue.h" #include "queue.h"
#include "proc.h" #include "proc.hh"
#include "kernel.h" #include "kernel.hh"
#include "amd64.h" #include "amd64.h"
#include "stat.h" #include "stat.h"
#include "fs.h" #include "fs.h"
}
#include "file.hh" #include "file.hh"
#include "vm.hh" #include "vm.hh"
extern "C" {
#include "elf.h" #include "elf.h"
#include "cpu.h" #include "cpu.hh"
#include "prof.h" #include "prof.hh"
#include <stddef.h> #include <stddef.h>
}
#define USTACKPAGES 2 #define USTACKPAGES 2
#define BRK (USERTOP >> 1) #define BRK (USERTOP >> 1)
......
extern "C" {
#include "types.h" #include "types.h"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "kernel.h" #include "kernel.hh"
#include "fs.h" #include "fs.h"
}
#include "file.hh" #include "file.hh"
extern "C" {
#include "stat.h" #include "stat.h"
#include "net.h" #include "net.hh"
}
struct devsw __mpalign__ devsw[NDEV]; struct devsw __mpalign__ devsw[NDEV];
......
extern "C" {
#include "types.h" #include "types.h"
#include <stddef.h> #include <stddef.h>
#include <stdarg.h> #include <stdarg.h>
#include "fmt.h" #include "fmt.hh"
#include "lib.h" #include "lib.h"
unsigned int strlen(const char*);
} extern "C" unsigned int strlen(const char*);
// //
// Print a number (base <= 16) in reverse order, // Print a number (base <= 16) in reverse order,
......
...@@ -10,24 +10,18 @@ ...@@ -10,24 +10,18 @@
// routines. The (higher-level) system call implementations // routines. The (higher-level) system call implementations
// are in sysfile.c. // are in sysfile.c.
extern "C" {
#include "types.h" #include "types.h"
#include "stat.h" #include "stat.h"
#include "mmu.h" #include "mmu.h"
#include "kernel.h" #include "kernel.hh"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "queue.h" #include "queue.h"
#include "proc.h" #include "proc.hh"
#include "fs.h" #include "fs.h"
}
#include "buf.hh" #include "buf.hh"
#include "file.hh" #include "file.hh"
#include "cpu.hh"
extern "C" {
#include "cpu.h"
}
#define min(a, b) ((a) < (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b))
static void itrunc(struct inode*); static void itrunc(struct inode*);
......
extern "C" {
#include "types.h" #include "types.h"
#include "kernel.h" #include "kernel.hh"
#include "mmu.h" #include "mmu.h"
#include "amd64.h" #include "amd64.h"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "queue.h" #include "queue.h"
#include "proc.h" #include "proc.hh"
#include "cpu.h" #include "cpu.hh"
}
#include "ns.hh" #include "ns.hh"
#include "atomic.hh" #include "atomic.hh"
......
extern "C" {
#include "types.h" #include "types.h"
#include "amd64.h" #include "amd64.h"
#include "mmu.h" #include "mmu.h"
#include "cpu.h" #include "cpu.hh"
#include "kernel.h" #include "kernel.hh"
#include "bits.h" #include "bits.h"
#include "spinlock.h" #include "spinlock.h"
#include "kalloc.h" #include "kalloc.h"
#include "queue.h" #include "queue.h"
#include "condvar.h" #include "condvar.hh"
#include "proc.h" #include "proc.hh"
#include <stddef.h>
}
#include "vm.hh" #include "vm.hh"
#include <stddef.h>
extern pml4e_t kpml4[]; extern pml4e_t kpml4[];
......
// Intel 8253/8254/82C54 Programmable Interval Timer (PIT). // Intel 8253/8254/82C54 Programmable Interval Timer (PIT).
// http://en.wikipedia.org/wiki/Intel_8253 // http://en.wikipedia.org/wiki/Intel_8253
extern "C" {
#include "types.h" #include "types.h"
#include "amd64.h" #include "amd64.h"
#include "kernel.h" #include "kernel.hh"
}
#define IO_TIMER1 0x040 // 8253 Timer #1 #define IO_TIMER1 0x040 // 8253 Timer #1
#define TIMER_FREQ 1193182 #define TIMER_FREQ 1193182
......
...@@ -2,11 +2,9 @@ ...@@ -2,11 +2,9 @@
// http://www.intel.com/design/chipsets/datashts/29056601.pdf // http://www.intel.com/design/chipsets/datashts/29056601.pdf
// See also picirq.c. // See also picirq.c.
extern "C" {
#include "types.h" #include "types.h"
#include "traps.h" #include "traps.h"
#include "kernel.h" #include "kernel.hh"
}
#define IOAPIC (KBASE + 0xFEC00000) // Default physical address of IO APIC #define IOAPIC (KBASE + 0xFEC00000) // Default physical address of IO APIC
......
...@@ -3,16 +3,14 @@ ...@@ -3,16 +3,14 @@
// Slab allocator, for chunks larger than one page. // Slab allocator, for chunks larger than one page.
// //
extern "C" {
#include "types.h" #include "types.h"
#include "mmu.h" #include "mmu.h"
#include "kernel.h" #include "kernel.hh"
#include "spinlock.h" #include "spinlock.h"
#include "kalloc.h" #include "kalloc.h"
#include "mtrace.h" #include "mtrace.h"
#include "cpu.h" #include "cpu.hh"
#include "multiboot.h" #include "multiboot.h"
}
static struct Mbmem mem[128]; static struct Mbmem mem[128];
static u64 nmem; static u64 nmem;
......
#include "types.h" #include "types.h"
#include "amd64.h" #include "amd64.h"
#include "kernel.h" #include "kern_c.h"
#include "kbd.h" #include "kbd.h"
int int
......
#include "mmu.h"
#include "lib.h"
// console.c
void consoleintr(int(*)(void));
// kbd.c
void kbdintr(void);
// swtch.S
struct context;
void swtch(struct context**, struct context*);
// trap.c
extern struct segdesc bootgdt[NSEGS];
// syscalls
long sys_chdir(void);
long sys_close(void);
long sys_dup(void);
long sys_exec(void);
long sys_exit(void);
long sys_fork(void);
long sys_fstat(void);
long sys_getpid(void);
long sys_kill(void);
long sys_link(void);
long sys_mkdir(void);
long sys_mknod(void);
long sys_open(void);
long sys_pipe(void);
long sys_read(void);
long sys_sbrk(void);
long sys_sleep(void);
long sys_unlink(void);
long sys_wait(void);
long sys_write(void);
long sys_uptime(void);
long sys_map(void);
long sys_unmap(void);
long sys_halt(void);
long sys_socket(int, int, int);
long sys_bind(int, void*, int);
long sys_listen(int, int);
long sys_accept(int, void*, void*);
long sys_pread(int fd, void *ubuf, size_t count, off_t offset);
long sys_kernlet(int, size_t, off_t);
extern long (*syscalls[])(u64, u64, u64, u64, u64, u64);
// other exported/imported functions
void cmain(u64 mbmagic, u64 mbaddr);
void mpboot(void);
void trapret(void);
void threadstub(void);
void threadhelper(void (*fn)(void *), void *arg);
struct trapframe;
void trap(struct trapframe *tf);
#include "mmu.h" extern "C" {
#include "lib.h" #include "kern_c.h"
}
#define KBASE 0xFFFFFF0000000000ull #define KBASE 0xFFFFFF0000000000ull
#define KSHARED 0xFFFFF00000000000ull #define KSHARED 0xFFFFF00000000000ull
...@@ -51,7 +52,6 @@ void panic(const char*, ...) ...@@ -51,7 +52,6 @@ void panic(const char*, ...)
__noret__ __attribute__((format(printf, 1, 2))); __noret__ __attribute__((format(printf, 1, 2)));
void kerneltrap(struct trapframe *tf) __noret__; void kerneltrap(struct trapframe *tf) __noret__;
void snprintf(char *buf, u32 n, const char *fmt, ...); void snprintf(char *buf, u32 n, const char *fmt, ...);
void consoleintr(int(*)(void));
#define assert(c) if (!(c)) { cprintf("%s:%d: ", __FILE__, __LINE__); panic("assertion failure"); } #define assert(c) if (!(c)) { cprintf("%s:%d: ", __FILE__, __LINE__); panic("assertion failure"); }
...@@ -224,7 +224,7 @@ void* memmove(void*, const void*, u32); ...@@ -224,7 +224,7 @@ void* memmove(void*, const void*, u32);
void* memset(void*, int, u32); void* memset(void*, int, u32);
void* memcpy(void*, const void *, u32); void* memcpy(void*, const void *, u32);
char* safestrcpy(char*, const char*, u32); char* safestrcpy(char*, const char*, u32);
unsigned int strlen(const char*); extern "C" unsigned int strlen(const char*);
int strncmp(const char*, const char*, u32); int strncmp(const char*, const char*, u32);
char* strncpy(char*, const char*, u32); char* strncpy(char*, const char*, u32);
int strcmp(const char *p, const char *q); int strcmp(const char *p, const char *q);
......
extern "C" {
#include "types.h" #include "types.h"
#include "kernel.h" #include "kernel.hh"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "cpu.h" #include "cpu.hh"
#include "proc.h" #include "proc.hh"
#include "fs.h" #include "fs.h"
#include "wq.h" #include "wq.hh"
#include "ipc.h" #include "ipc.hh"
}
#include "vm.hh" #include "vm.hh"
#include "file.hh" #include "file.hh"
......
...@@ -2,15 +2,13 @@ ...@@ -2,15 +2,13 @@
// Allocate objects smaller than a page. // Allocate objects smaller than a page.
// //
extern "C" {
#include "types.h" #include "types.h"
#include "mmu.h" #include "mmu.h"
#include "kernel.h" #include "kernel.hh"
#include "spinlock.h" #include "spinlock.h"
#include "kalloc.h" #include "kalloc.h"
#include "mtrace.h" #include "mtrace.h"
#include "cpu.h" #include "cpu.hh"
}
// allocate in power-of-two sizes up to 2^KMMAX // allocate in power-of-two sizes up to 2^KMMAX
// must be < 12 // must be < 12
......
// The local APIC manages internal (non-I/O) interrupts. // The local APIC manages internal (non-I/O) interrupts.
// See Chapter 8 & Appendix C of Intel processor manual volume 3. // See Chapter 8 & Appendix C of Intel processor manual volume 3.
extern "C" {
#include "types.h" #include "types.h"
#include "amd64.h" #include "amd64.h"
#include "kernel.h" #include "kernel.hh"
#include "traps.h" #include "traps.h"
#include "bits.h" #include "bits.h"
}
// Local APIC registers, divided by 4 for use as uint[] indices. // Local APIC registers, divided by 4 for use as uint[] indices.
#define ID (0x0020/4) // ID #define ID (0x0020/4) // ID
......
extern "C" {
#include "types.h" #include "types.h"
#include "multiboot.h" #include "multiboot.h"
#include "kernel.h" #include "kernel.hh"
#include "spinlock.h" #include "spinlock.h"
#include "kalloc.h" #include "kalloc.h"
#include "cpu.h" #include "cpu.hh"
#include "amd64.h" #include "amd64.h"
}
static volatile int bstate; static volatile int bstate;
......
// Fake IDE disk; stores blocks in memory. // Fake IDE disk; stores blocks in memory.
// Useful for running kernel without scratch disk. // Useful for running kernel without scratch disk.
extern "C" {
#include "types.h" #include "types.h"
#include "mmu.h" #include "mmu.h"
#include "kernel.h" #include "kernel.hh"
#include "spinlock.h" #include "spinlock.h"
#include "queue.h" #include "queue.h"
#include "condvar.h" #include "condvar.hh"
#include "proc.h" #include "proc.hh"
#include "amd64.h" #include "amd64.h"
#include "traps.h" #include "traps.h"
}
#include "buf.hh" #include "buf.hh"
......
...@@ -2,13 +2,11 @@ ...@@ -2,13 +2,11 @@
// Search memory for MP description structures. // Search memory for MP description structures.
// http://developer.intel.com/design/pentium/datashts/24201606.pdf // http://developer.intel.com/design/pentium/datashts/24201606.pdf
extern "C" {
#include "types.h" #include "types.h"
#include "amd64.h" #include "amd64.h"
#include "mp.h" #include "mp.h"
#include "kernel.h" #include "kernel.hh"
#include "cpu.h" #include "cpu.hh"
}
struct cpu cpus[NCPU]; struct cpu cpus[NCPU];
static struct cpu *bcpu __mpalign__; static struct cpu *bcpu __mpalign__;
......
...@@ -10,28 +10,24 @@ extern "C" { ...@@ -10,28 +10,24 @@ extern "C" {
} }
#endif #endif
extern "C" {
#include "types.h" #include "types.h"
#include "kernel.h" #include "kernel.hh"
#include "queue.h" #include "queue.h"
#ifndef LWIP #ifndef LWIP
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#endif #endif
#include "proc.h" #include "proc.hh"
#include "fs.h" #include "fs.h"
}
#include "file.hh" #include "file.hh"
#include "net.hh"
extern "C" {
#include "net.h"
#ifdef LWIP #ifdef LWIP
extern "C" {
err_t if_init(struct netif *netif); err_t if_init(struct netif *netif);
void if_input(struct netif *netif, void *buf, u16 len); void if_input(struct netif *netif, void *buf, u16 len);
#endif
} }
#endif
void void
netfree(void *va) netfree(void *va)
......
extern "C" {
#include "types.h" #include "types.h"
#include "amd64.h" #include "amd64.h"
#include "kernel.h" #include "kernel.hh"
#include "pci.h" #include "pci.hh"
#include "pcireg.h" #include "pcireg.hh"
}
extern int e1000attach(struct pci_func *pcif); extern int e1000attach(struct pci_func *pcif);
extern int e1000eattach(struct pci_func *pcif); extern int e1000eattach(struct pci_func *pcif);
......
// Intel 8259A programmable interrupt controllers. // Intel 8259A programmable interrupt controllers.
extern "C" {
#include "types.h" #include "types.h"
#include "amd64.h" #include "amd64.h"
#include "traps.h" #include "traps.h"
#include "kernel.h" #include "kernel.hh"
}
// I/O Addresses of the two programmable interrupt controllers // I/O Addresses of the two programmable interrupt controllers
#define IO_PIC1 0x20 // Master (IRQs 0-7) #define IO_PIC1 0x20 // Master (IRQs 0-7)
......
extern "C" {
#include "types.h" #include "types.h"
#include "mmu.h" #include "mmu.h"
#include "kernel.h" #include "kernel.hh"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "queue.h" #include "queue.h"
#include "proc.h" #include "proc.hh"
#include "fs.h" #include "fs.h"
}
#include "file.hh" #include "file.hh"
#include "cpu.hh"
extern "C" {
#include "cpu.h"
}
#define PIPESIZE 512 #define PIPESIZE 512
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "user.h" #include "user.h"
#include "lib.h" #include "lib.h"
#include "amd64.h" #include "amd64.h"
#include "ipc.h" #include "ipc.hh"
// XXX(sbw) add a memlayout.h? // XXX(sbw) add a memlayout.h?
#define KSHARED 0xFFFFF00000000000ull #define KSHARED 0xFFFFF00000000000ull
......
#include "types.h" #include "types.h"
#include "stat.h" #include "stat.h"
#include "user.h" #include "user.h"
extern "C" {
#include <stdarg.h> #include <stdarg.h>
#include "fmt.h" #include "fmt.hh"
}
// Print to the given fd. // Print to the given fd.
static void static void
......
extern "C" {
#include "types.h" #include "types.h"
#include "kernel.h" #include "kernel.hh"
#include "mmu.h" #include "mmu.h"
#include "amd64.h" #include "amd64.h"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "queue.h" #include "queue.h"
#include "proc.h" #include "proc.hh"
#include "cpu.h" #include "cpu.hh"
#include "bits.h" #include "bits.h"
#include "kmtrace.h" #include "kmtrace.h"
#include "sched.h" #include "sched.hh"
#include "kalloc.h" #include "kalloc.h"
}
#include "vm.hh" #include "vm.hh"
#include "ns.hh" #include "ns.hh"
......
extern "C" {
#include "types.h" #include "types.h"
#include "kernel.h" #include "kernel.hh"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "fs.h" #include "fs.h"
}
#include "file.hh" #include "file.hh"
#include "prof.hh"
extern "C" {
#include "prof.h"
#include "bits.h" #include "bits.h"
#include "amd64.h" #include "amd64.h"
}
extern profctr_t sprof[]; extern profctr_t sprof[];
extern profctr_t eprof[]; extern profctr_t eprof[];
......
extern "C" {
#include "param.h" #include "param.h"
#include "types.h" #include "types.h"
#include "kernel.h" #include "kernel.hh"
#include "cpu.h" #include "cpu.hh"
}
struct seed { struct seed {
u64 v; u64 v;
......
extern "C" {
#include "types.h" #include "types.h"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "fs.h" #include "fs.h"
#include "kernel.h" #include "kernel.hh"
#include "stat.h" #include "stat.h"
#include "kalloc.h" #include "kalloc.h"
}
#include "file.hh" #include "file.hh"
extern "C" {
#include "bits.h" #include "bits.h"
#include "amd64.h" #include "amd64.h"
#include "cpu.h" #include "cpu.hh"
#include "sampler.h" #include "sampler.h"
}
#define LOGHEADER_SZ (sizeof(struct logheader) + \ #define LOGHEADER_SZ (sizeof(struct logheader) + \
sizeof(((struct logheader*)0)->cpu[0])*NCPU) sizeof(((struct logheader*)0)->cpu[0])*NCPU)
......
extern "C" {
#include "types.h" #include "types.h"
#include "kernel.h" #include "kernel.hh"
#include "mmu.h" #include "mmu.h"
#include "amd64.h" #include "amd64.h"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "queue.h" #include "queue.h"
#include "proc.h" #include "proc.hh"
#include "cpu.h" #include "cpu.hh"
#include "bits.h" #include "bits.h"
#include "kmtrace.h" #include "kmtrace.h"
#include "sched.h" #include "sched.h"
#include <stddef.h>
}
#include "vm.hh" #include "vm.hh"
#include <stddef.h>
enum { sched_debug = 0 }; enum { sched_debug = 0 };
......
// Mutual exclusion spin locks. // Mutual exclusion spin locks.
extern "C" {
#include "types.h" #include "types.h"
#include "kernel.h" #include "kernel.hh"
#include "amd64.h" #include "amd64.h"
#include "cpu.h" #include "cpu.hh"
#include "bits.h" #include "bits.h"
#include "spinlock.h" #include "spinlock.h"
#include "mtrace.h" #include "mtrace.h"
#include "condvar.h" #include "condvar.hh"
#include "fs.h" #include "fs.h"
}
#include "file.hh" #include "file.hh"
#if LOCKSTAT #if LOCKSTAT
......
extern "C" {
#include "types.h" #include "types.h"
#include "amd64.h" #include "amd64.h"
#include "kernel.h" #include "kernel.hh"
}
void* void*
memset(void *dst, int c, u32 n) memset(void *dst, int c, u32 n)
......
extern "C" {
#include "types.h" #include "types.h"
#include "mmu.h" #include "mmu.h"
#include "kernel.h" #include "kernel.hh"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "queue.h" #include "queue.h"
#include "proc.h" #include "proc.hh"
#include "amd64.h" #include "amd64.h"
#include "syscall.h" #include "syscall.h"
#include "cpu.h" #include "cpu.hh"
#include "kmtrace.h" #include "kmtrace.h"
}
// User code makes a system call with INT T_SYSCALL. // User code makes a system call with INT T_SYSCALL.
// System call number in %eax. // System call number in %eax.
......
extern "C" {
#include "types.h" #include "types.h"
#include "stat.h" #include "stat.h"
#include "mmu.h" #include "mmu.h"
#include "kernel.h" #include "kernel.hh"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "queue.h" #include "queue.h"
#include "proc.h" #include "proc.hh"
#include "fs.h" #include "fs.h"
}
#include "file.hh" #include "file.hh"
extern "C" {
#include "fcntl.h" #include "fcntl.h"
#include "cpu.h" #include "cpu.hh"
#include "net.h" #include "net.hh"
}
// Fetch the nth word-sized system call argument as a file descriptor // Fetch the nth word-sized system call argument as a file descriptor
// and return both the descriptor and the corresponding struct file. // and return both the descriptor and the corresponding struct file.
......
extern "C" {
#include "types.h" #include "types.h"
#include "amd64.h" #include "amd64.h"
#include "kernel.h" #include "kernel.hh"
#include "mmu.h" #include "mmu.h"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "queue.h" #include "queue.h"
#include "proc.h" #include "proc.hh"
#include "cpu.h" #include "cpu.hh"
}
#include "vm.hh" #include "vm.hh"
long long
......
extern "C" {
#include "types.h" #include "types.h"
#include "mmu.h" #include "mmu.h"
#include "kernel.h" #include "kernel.hh"
#include "amd64.h" #include "amd64.h"
#include "cpu.h" #include "cpu.hh"
#include "traps.h" #include "traps.h"
#include "queue.h" #include "queue.h"
#include "spinlock.h" #include "spinlock.h"
#include "condvar.h" #include "condvar.hh"
#include "proc.h" #include "proc.hh"
#include "kmtrace.h" #include "kmtrace.h"
#include "bits.h" #include "bits.h"
}
struct intdesc idt[256] __attribute__((aligned(16))); struct intdesc idt[256] __attribute__((aligned(16)));
......
// Intel 8250 serial port (UART). // Intel 8250 serial port (UART).
// http://en.wikibooks.org/wiki/Serial_Programming/8250_UART_Programming // http://en.wikibooks.org/wiki/Serial_Programming/8250_UART_Programming
extern "C" {
#include "types.h" #include "types.h"
#include "kernel.h" #include "kernel.hh"
#include "amd64.h" #include "amd64.h"
#include "traps.h" #include "traps.h"
}
#define COM2 0x2f8 #define COM2 0x2f8
#define COM1 0x3f8 #define COM1 0x3f8
......
extern "C" {
#include "types.h" #include "types.h"
#include "amd64.h" #include "amd64.h"
#include "mmu.h" #include "mmu.h"
#include "cpu.h" #include "cpu.hh"
#include "kernel.h" #include "kernel.hh"
#include "bits.h" #include "bits.h"
#include "spinlock.h" #include "spinlock.h"
#include "kalloc.h" #include "kalloc.h"
#include "queue.h" #include "queue.h"
#include "condvar.h" #include "condvar.hh"
#include "proc.h" #include "proc.hh"
}
#include "vm.hh" #include "vm.hh"
#include "gc.hh" #include "gc.hh"
#include "crange.hh" #include "crange.hh"
......
extern "C" {
#include "types.h" #include "types.h"
#include "kernel.h" #include "kernel.hh"
#include "spinlock.h" #include "spinlock.h"
#include "amd64.h" #include "amd64.h"
#include "cpu.h" #include "cpu.hh"
#include "wq.h" #include "wq.hh"
}
#define NSLOTS (1 << WQSHIFT) #define NSLOTS (1 << WQSHIFT)
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论