UbixOS V2 2.0

Macros | Typedefs | Functions
vmm_mmap.c File Reference
`#include <vmm/vmm.h>`
`#include <sys/types.h>`
`#include <lib/kprintf.h>`
`#include <sys/descrip.h>`
`#include <ubixos/kpanic.h>`
`#include <ubixos/spinlock.h>`
`#include <ubixos/sched.h>`
Include dependency graph for vmm_mmap.c:

Go to the source code of this file.

## Macros
#define | EINVAL 22 /* Invalid argument */
#define | MAP_ALIGNED(n) ((n) << MAP_ALIGNMENT_SHIFT)
#define | MAP_ALIGNED_SUPER MAP_ALIGNED(1) /* align on a superpage */
#define | MAP_ALIGNMENT_MASK MAP_ALIGNED(0xff)
#define | MAP_ALIGNMENT_SHIFT 24
#define | MAP_ANON 0x1000 /* allocated from memory, swap space */
#define | MAP_FILE 0x0000 /* map from file (default) */
#define | MAP_FIXED 0x0010 /* map addr must be exactly as requested */
#define | MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */
#define | MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */
#define | MAP_NOSYNC 0x0800 /* page to but do not sync underlying file */
#define | MAP_PRIVATE 0x0002 /* changes are private */
#define | MAP_RENAME 0x0020 /* Sun: rename private pages to file */
#define | MAP_RESERVED0080 0x0080 /* previously misimplemented MAP_INHERIT */
#define | MAP_RESERVED0100 0x0100 /* previously unimplemented MAP_NOEXTEND */
#define | MAP_SHARED 0x0001 /* share changes */
#define | MAP_STACK 0x0400 /* region grows down, like a stack */
#define | NBBY 8 /* number of bits in a byte */
#define | PROT_EXEC 0x04 /* pages can be executed */
#define | PROT_NONE 0x00 /* no permissions */
#define | PROT_READ 0x01 /* pages can be read */
#define | PROT_WRITE 0x02 /* pages can be written */

## Typedefs
typedef __uint32_t | __vm_size_t
typedef __vm_size_t | vm_size_t

## Functions
int | freebsd6_mmap (struct thread *td, struct freebsd6_mmap_args *uap)
int | sys_mmap (struct thread *td, struct sys_mmap_args *uap)
int | sys_munmap (struct thread *td, struct sys_munmap_args *uap)

## Macro Definition Documentation

## ◆ EINVAL

#define EINVAL 22 /* Invalid argument */

Definition at line 40 of file vmm_mmap.c.

## ◆ MAP_ALIGNED

#define MAP_ALIGNED | ( |  | n | ) | ((n) << MAP_ALIGNMENT_SHIFT)

Definition at line 41 of file vmm_mmap.c.

## ◆ MAP_ALIGNED_SUPER

#define MAP_ALIGNED_SUPER MAP_ALIGNED(1) /* align on a superpage */

Definition at line 44 of file vmm_mmap.c.

## ◆ MAP_ALIGNMENT_MASK

#define MAP_ALIGNMENT_MASK MAP_ALIGNED(0xff)

Definition at line 43 of file vmm_mmap.c.

## ◆ MAP_ALIGNMENT_SHIFT

#define MAP_ALIGNMENT_SHIFT 24

Definition at line 42 of file vmm_mmap.c.

## ◆ MAP_ANON

#define MAP_ANON 0x1000 /* allocated from memory, swap space */

Definition at line 73 of file vmm_mmap.c.

## ◆ MAP_FILE

#define MAP_FILE 0x0000 /* map from file (default) */

Definition at line 72 of file vmm_mmap.c.

## ◆ MAP_FIXED

#define MAP_FIXED 0x0010 /* map addr must be exactly as requested */

Definition at line 60 of file vmm_mmap.c.

## ◆ MAP_HASSEMAPHORE

#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */

Definition at line 65 of file vmm_mmap.c.

## ◆ MAP_NORESERVE

#define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */

Definition at line 62 of file vmm_mmap.c.

## ◆ MAP_NOSYNC

#define MAP_NOSYNC 0x0800 /* page to but do not sync underlying file */

Definition at line 67 of file vmm_mmap.c.

## ◆ MAP_PRIVATE

#define MAP_PRIVATE 0x0002 /* changes are private */

Definition at line 59 of file vmm_mmap.c.

## ◆ MAP_RENAME

#define MAP_RENAME 0x0020 /* Sun: rename private pages to file */

Definition at line 61 of file vmm_mmap.c.

## ◆ MAP_RESERVED0080

#define MAP_RESERVED0080 0x0080 /* previously misimplemented MAP_INHERIT */

Definition at line 63 of file vmm_mmap.c.

## ◆ MAP_RESERVED0100

#define MAP_RESERVED0100 0x0100 /* previously unimplemented MAP_NOEXTEND */

Definition at line 64 of file vmm_mmap.c.

## ◆ MAP_SHARED

#define MAP_SHARED 0x0001 /* share changes */

Definition at line 58 of file vmm_mmap.c.

## ◆ MAP_STACK

#define MAP_STACK 0x0400 /* region grows down, like a stack */

Definition at line 66 of file vmm_mmap.c.

## ◆ NBBY

#define NBBY 8 /* number of bits in a byte */

Definition at line 45 of file vmm_mmap.c.

## ◆ PROT_EXEC

#define PROT_EXEC 0x04 /* pages can be executed */

Definition at line 51 of file vmm_mmap.c.

## ◆ PROT_NONE

#define PROT_NONE 0x00 /* no permissions */

Definition at line 48 of file vmm_mmap.c.

## ◆ PROT_READ

#define PROT_READ 0x01 /* pages can be read */

Definition at line 49 of file vmm_mmap.c.

## ◆ PROT_WRITE

#define PROT_WRITE 0x02 /* pages can be written */

Definition at line 50 of file vmm_mmap.c.

## Typedef Documentation

## ◆ __vm_size_t

typedef __uint32_t __vm_size_t

Definition at line 38 of file vmm_mmap.c.

## ◆ vm_size_t

typedef __vm_size_t vm_size_t

Definition at line 39 of file vmm_mmap.c.

## Function Documentation

## ◆ freebsd6_mmap()

int freebsd6_mmap | ( | struct thread * | td,
|  | struct freebsd6_mmap_args * | uap
| ) |  |

Definition at line 75 of file vmm_mmap.c.

References _current, freebsd6_mmap_args::addr, EINVAL, freebsd6_mmap_args::fd, freebsd6_mmap_args::flags, taskStruct::id, K_PANIC, kprintf(), freebsd6_mmap_args::len, MAP_ALIGNED_SUPER, MAP_ALIGNMENT_MASK, MAP_ALIGNMENT_SHIFT, MAP_ANON, MAP_FIXED, NBBY, freebsd6_mmap_args::pad, PAGE_DEFAULT, PAGE_MASK, PAGE_SHIFT, freebsd6_mmap_args::pos, freebsd6_mmap_args::prot, round_page, vmm_findFreePage(), and vmm_remapPage().

Here is the call graph for this function:

## ◆ sys_mmap()

int sys_mmap | ( | struct thread * | td,
|  | struct sys_mmap_args * | uap
| ) |  |

Definition at line 162 of file vmm_mmap.c.

References _current, sys_mmap_args::addr, bzero, file::fd, sys_mmap_args::fd, fread(), fseek(), getfd(), taskStruct::id, K_PANIC, kpanic(), sys_mmap_args::len, PAGE_DEFAULT, sys_mmap_args::pos, round_page, thread::td_retval, VM_TASK, vmm_findFreePage(), VMM_FREE, vmm_getFreeVirtualPage(), vmm_remapPage(), and vmm_unmapPage().

Here is the call graph for this function:

## ◆ sys_munmap()

int sys_munmap | ( | struct thread * | td,
|  | struct sys_munmap_args * | uap
| ) |  |

Definition at line 155 of file vmm_mmap.c.

References thread::td_retval.