diff options
author | Sanjit Bhat <[email protected]> | 2023-11-02 10:26:45 -0400 |
---|---|---|
committer | Sanjit Bhat <[email protected]> | 2023-11-02 10:26:45 -0400 |
commit | 03e8bd76560d4a1883ef15846df0e52748d61bdf (patch) | |
tree | 7cb19d672264cd8027c115f0b8b16e09e62432e8 | |
parent | 4dc51124c8a8e3f1914add43bf1376663eb9a9b8 (diff) | |
download | xv6-labs-03e8bd76560d4a1883ef15846df0e52748d61bdf.tar.gz xv6-labs-03e8bd76560d4a1883ef15846df0e52748d61bdf.tar.bz2 xv6-labs-03e8bd76560d4a1883ef15846df0e52748d61bdf.zip |
mmap: add in off_t size_t defs
-rw-r--r-- | kernel/defs.h | 57 | ||||
-rw-r--r-- | user/user.h | 13 |
2 files changed, 70 insertions, 0 deletions
diff --git a/kernel/defs.h b/kernel/defs.h index a3c962b..859fc41 100644 --- a/kernel/defs.h +++ b/kernel/defs.h @@ -1,3 +1,7 @@ +#ifdef LAB_MMAP +typedef unsigned long size_t; +typedef long int off_t; +#endif struct buf; struct context; struct file; @@ -8,6 +12,10 @@ struct spinlock; struct sleeplock; struct stat; struct superblock; +#ifdef LAB_NET +struct mbuf; +struct sock; +#endif // bio.c void binit(void); @@ -117,6 +125,12 @@ void initlock(struct spinlock*, char*); void release(struct spinlock*); void push_off(void); void pop_off(void); +#if defined(LAB_LOCK) || defined(LAB_NET) +int atomic_read4(int *addr); +#endif +#ifdef LAB_LOCK +void freelock(struct spinlock*); +#endif // sleeplock.c void acquiresleep(struct sleeplock*); @@ -187,3 +201,46 @@ void virtio_disk_intr(void); // number of elements in fixed-size array #define NELEM(x) (sizeof(x)/sizeof((x)[0])) + + + +#ifdef LAB_PGTBL +// vmcopyin.c +int copyin_new(pagetable_t, char *, uint64, uint64); +int copyinstr_new(pagetable_t, char *, uint64, uint64); +#endif + +#ifdef LAB_LOCK +// stats.c +void statsinit(void); +void statsinc(void); + +// sprintf.c +int snprintf(char*, int, char*, ...); +#endif + +#ifdef KCSAN +void kcsaninit(); +#endif + +#ifdef LAB_NET +// pci.c +void pci_init(); + +// e1000.c +void e1000_init(uint32 *); +void e1000_intr(void); +int e1000_transmit(struct mbuf*); + +// net.c +void net_rx(struct mbuf*); +void net_tx_udp(struct mbuf*, uint32, uint16, uint16); + +// sysnet.c +void sockinit(void); +int sockalloc(struct file **, uint32, uint16, uint16); +void sockclose(struct sock *); +int sockread(struct sock *, uint64, int); +int sockwrite(struct sock *, uint64, int); +void sockrecvudp(struct mbuf*, uint32, uint16, uint16); +#endif diff --git a/user/user.h b/user/user.h index 4d398d5..c6f51b7 100644 --- a/user/user.h +++ b/user/user.h @@ -1,3 +1,7 @@ +#ifdef LAB_MMAP +typedef unsigned long size_t; +typedef long int off_t; +#endif struct stat; // system calls @@ -22,6 +26,14 @@ int getpid(void); char* sbrk(int); int sleep(int); int uptime(void); +#ifdef LAB_NET +int connect(uint32, uint16, uint16); +#endif +#ifdef LAB_PGTBL +int pgaccess(void *base, int len, void *mask); +// usyscall region +int ugetpid(void); +#endif // ulib.c int stat(const char*, struct stat*); @@ -39,3 +51,4 @@ void free(void*); int atoi(const char*); int memcmp(const void *, const void *, uint); void *memcpy(void *, const void *, uint); +int statistics(void*, int); |