user_space #4

Merged
mathieu merged 40 commits from user_space into master 2021-11-04 16:17:36 +01:00
2 changed files with 7 additions and 3 deletions
Showing only changes of commit 2c6ffe34a1 - Show all commits

View File

@ -1,8 +1,9 @@
#include "mem.h"
#include "assert.h"
#include "errno.h"
#include "kernel.h"
#include "klibc.h"
#include "list.h"
#include "mem.h"
#include "types.h"
static struct phyMemDesc *pageDesc = (struct phyMemDesc *)&__ld_kernel_end;
@ -139,9 +140,10 @@ int unrefPhyPage(paddr_t addr)
{
struct phyMemDesc *mem = addr2memDesc(addr);
if (!mem) {
return -1;
return -EINVAL;
}
assert(mem->ref > 0);
if(mem->ref <= 0)
return -EINVAL;
mem->ref--;
if (mem->ref == 0) {
allocatedPage--;

View File

@ -7,6 +7,8 @@
#define PAGE_SHIFT 12U
#define PAGE_SIZE (1U << PAGE_SHIFT)
#define PAGE_MASK (PAGE_SIZE - 1)
// Defined in linker.ld script
extern uint32_t __ld_kernel_begin;