mmap #8
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#ifdef __KERNEL__
|
||||
#include "cpu_context.h"
|
||||
#include "cpu_context.h"
|
||||
#endif
|
||||
|
||||
#define SYSCALL_ID_EXIT 1
|
||||
@ -8,7 +8,7 @@
|
||||
#define SYSCALL_ID_PUTC 3
|
||||
#define SYSCALL_ID_READ 4
|
||||
#define SYSCALL_ID_TEST 5
|
||||
#define SYSCALL_ID_BRK 6
|
||||
#define SYSCALL_ID_BRK 6
|
||||
#define SYSCALL_ID_MMAP 7
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
@ -8,7 +8,9 @@ struct uAddrSpace;
|
||||
struct uAddrVirtualReg;
|
||||
|
||||
#define UA_MAP_SHARED (1 << 0)
|
||||
#define UA_MAP_FIXED (1 << 1)
|
||||
#define UA_MAP_PRIVATE (1 << 1)
|
||||
#define UA_MAP_FIXED (1 << 2)
|
||||
|
||||
// TODO : move this struct to .c and add accessors
|
||||
struct uAddrVirtualReg {
|
||||
uaddr_t addr;
|
||||
@ -38,10 +40,9 @@ struct mappedRessource {
|
||||
int (*onResMapped)(struct uAddrVirtualReg *reg); // Callabck for when the ressourced get mapped
|
||||
};
|
||||
|
||||
|
||||
struct uAddrSpace * uAddrSpaceCreate(struct process *proc);
|
||||
struct uAddrSpace *uAddrSpaceCreate(struct process *proc);
|
||||
int uAddrSpaceDelete(struct uAddrSpace *addr);
|
||||
struct mmu_context * uAddrSpaceGetMMUContext(struct uAddrSpace *addr);
|
||||
struct mmu_context *uAddrSpaceGetMMUContext(struct uAddrSpace *addr);
|
||||
int uAddrSpaceSetHeap(struct uAddrSpace *as, uaddr_t addr, size_t size);
|
||||
int uAddrSpaceHeapCheckNAlloc(struct uAddrSpace *as, vaddr_t addr);
|
||||
uaddr_t sysBrk(struct uAddrSpace *as, uaddr_t newHeapTop);
|
||||
|
@ -36,10 +36,6 @@ int putc(const int c);
|
||||
int vsnprintf(char *str, size_t size, const char *format, va_list ap) __attribute__ ((__format__ (printf, 3, 0)));
|
||||
int vprintf(const char *format, va_list ap) __attribute__ ((__format__ (printf, 1, 0)));
|
||||
int printf(const char *format, ...) __attribute__ ((__format__ (printf, 1, 2)));
|
||||
/* To keep in sync with PAGING_MEM_* */
|
||||
#define PROT_EXEC (1<<3)
|
||||
#define PROT_READ (1<<1)
|
||||
#define PROT_WRITE (1<<2)
|
||||
void *mmap(void *addr, size_t len, int prot, int flags, char *path);
|
||||
|
||||
int asprintf(char **strp, const char *fmt, ...) __attribute__ ((__format__ (printf, 2, 3)));
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "libc.h"
|
||||
#include "stdarg.h"
|
||||
#include "sys/mman.h"
|
||||
#include "tiny.h"
|
||||
|
||||
int func_help()
|
||||
|
11
userspace/sys/mman.h
Normal file
11
userspace/sys/mman.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
/* To keep in sync with PAGING_MEM_* */
|
||||
#define PROT_EXEC (1<<3)
|
||||
#define PROT_READ (1<<1)
|
||||
#define PROT_WRITE (1<<2)
|
||||
|
||||
#define MAP_SHARED (1 << 0)
|
||||
#define MAP_PRIVATE (1 << 1)
|
||||
#define MAP_FIXED (1 << 2)
|
||||
|
Loading…
Reference in New Issue
Block a user