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

all c++ userspace except for system calls and lwip

上级 bfea5822
......@@ -26,7 +26,7 @@ COMFLAGS := -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall \
-DHW_$(HW) -include param.h -include compiler.h
COMFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
CFLAGS := $(COMFLAGS) -std=c99
CXXFLAGS := $(COMFLAGS) -std=c++0x
CXXFLAGS := $(COMFLAGS) -std=c++0x -Wno-sign-compare
ASFLAGS = -m64 -gdwarf-2 -MD
LDFLAGS += -m elf_x86_64
......
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
}
char buf[512];
......
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
#include "mtrace.h"
#include "amd64.h"
#include "fcntl.h"
}
enum { nthread = 2 };
enum { nloop = 100 };
......
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
}
int
main(int argc, char *argv[])
......
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
#include "mtrace.h"
#include "amd64.h"
}
#define NITERS 16
......
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
#include "mtrace.h"
}
#define NCHILD 2
#define NDEPTH 7
......
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
#include "mtrace.h"
}
#define NCHILD 2
#define NDEPTH 5
......
extern "C" {
#include "types.h"
#include "user.h"
#include "lib.h"
#include "unet.h"
#include "fcntl.h"
#include "stat.h"
}
#define VERSION "0.1"
#define HTTP_VERSION "1.0"
......
// init: The initial user-level program
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
#include "fcntl.h"
#include "lib.h"
}
static const char *sh_argv[] = { "sh", 0 };
static const char *app_argv[][MAXARG] = {
......
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
#include "fcntl.h"
#include "amd64.h"
#include "lockstat.h"
}
static void
xwrite(int fd, char c)
......
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
#include "fs.h"
}
const char*
fmtname(const char *path)
......
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
#include "mtrace.h"
#include "amd64.h"
#include "uspinlock.h"
}
static struct uspinlock l;
static volatile int tcount;
......
......@@ -55,7 +55,7 @@ main(void)
}
sbrk(4096);
forkt(sbrk(0), thr, 0);
forkt(sbrk(0), (void*) thr, 0);
acquire(&l);
state = 1;
......
......@@ -37,7 +37,7 @@ void
vprintfmt(void (*putch) (void*, char), void *putarg,
const char *fmt, va_list ap)
{
char *s;
const char *s;
int c, i, state;
state = 0;
......@@ -58,7 +58,7 @@ vprintfmt(void (*putch) (void*, char), void *putarg,
state = 'l';
continue;
} else if(c == 's'){
s = (char*) va_arg(ap, char*);
s = (const char*) va_arg(ap, const char*);
if(s == 0)
s = "(null)";
while(*s != 0){
......@@ -119,7 +119,7 @@ struct bufstate {
static void
writebuf(void *arg, char c)
{
struct bufstate *bs = arg;
struct bufstate *bs = (bufstate*) arg;
if (bs->p < bs->e) {
bs->p[0] = c;
bs->p++;
......
// Shell.
extern "C" {
#include "types.h"
#include "user.h"
#include "fcntl.h"
}
// Parsed command representation
#define EXEC 1
......
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
#include "fcntl.h"
#include "amd64.h"
}
int
main(int ac, char *av[])
......
extern "C" {
#include "types.h"
#include "user.h"
#include "unet.h"
}
int
main(void)
......
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
#include "mtrace.h"
#include "amd64.h"
#include "uspinlock.h"
}
static struct uspinlock l;
static volatile int tcount;
......
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
#include "fcntl.h"
#include "amd64.h"
}
int
main(int ac, const char *av[])
......
......@@ -124,8 +124,8 @@ memmove(void *vdst, const void *vsrc, int n)
const char *src;
char *dst;
dst = vdst;
src = vsrc;
dst = (char*) vdst;
src = (const char*) vsrc;
while(n-- > 0)
*dst++ = *src++;
return vdst;
......
#ifdef LWIP
extern "C" {
#include "lwip/sockets.h"
// system calls
......@@ -7,6 +8,7 @@ extern int bind(int sockfd, const struct sockaddr *addr,
socklen_t addrlen);
extern int listen(int sockfd, int backlog);
extern int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
}
static inline const char *
ipaddr(struct sockaddr_in *sin)
......
struct stat;
// system calls
extern "C" {
int fork(int);
int exit(void) __attribute__((noreturn));
int wait(void);
......@@ -25,6 +26,7 @@ int uptime(void);
int map(void *addr, int len);
int unmap(void *addr, int len);
void halt(void);
}
// ulib.c
int stat(char*, struct stat*);
......@@ -42,7 +44,9 @@ void free(void*);
int atoi(const char*);
// uthread.S
extern "C" {
int forkt(void *sp, void *pc, void *arg);
}
// printf.c
void printf(int, const char*, ...);
......
extern "C" {
#include "types.h"
#include "stat.h"
#include "user.h"
......@@ -6,7 +5,6 @@ extern "C" {
#include "fcntl.h"
#include "syscall.h"
#include "traps.h"
}
char buf[2048];
char name[3];
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论