[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH 05/11] paddr_t nach uintptr_t geändert
! paddr_t: Beschreibt physische Adressen, auf die nicht ohne weiteres
zugegriffen werden kann. Es sollte also auf keinen Fall einem normalen
void*-Pointer entsprechen.
--HG--
rename : src/include/arch/i386/types.h => src/include/types.h
extra : rebase_source : 91ece43d76f531dd2fa5a3363ba1866d7f689251
---
Makefile | 8 ++--
src/include/types.h | 2 +-
src/kernel/include/kernel.h | 15 +++---
src/kernel/include/phys.h | 6 ++-
src/kernel/src/debug.c | 2 +-
src/kernel/src/mm/kmm.c | 4 +-
src/kernel/src/mm/paging.c | 23 ++++----
src/kernel/src/mm/phys.c | 82 ++++++++++++++--------------
src/kernel/src/modules.c | 19 ++++---
src/kernel/src/rpc.c | 4 +-
src/kernel/src/syscall.c | 6 +-
src/kernel/src/vm86.c | 14 +++---
src/kernel2/include/arch/i386/mm_arch.h | 3 +-
src/kernel2/src/arch/i386/gdt.c | 2 +-
src/kernel2/src/arch/i386/mm/mm_context.c | 19 +++----
src/kernel2/src/arch/i386/mm/virt.c | 10 ++--
src/kernel2/src/arch/i386/vm86.c | 6 +-
src/kernel2/src/interrupts/apic.c | 2 +-
src/kernel2/src/mm/phys.c | 51 ++++++++---------
src/kernel2/src/syscalls/pm.c | 2 +-
src/kernel2/src/syscalls/rpc.c | 2 +-
src/kernel2/src/tasks/modules.c | 10 ++--
22 files changed, 147 insertions(+), 145 deletions(-)
diff --git a/Makefile b/Makefile
index a99b53e..9b89f4a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
-include Makefile.local
-CC=gcc -m32 -g -c -fno-stack-protector -nostdinc -fno-leading-underscore -fno-omit-frame-pointer -Wall -Werror -Wstrict-prototypes -fno-strict-aliasing -O2 -fno-builtin -I .
-CPP=g++ -m32 -g -c -fno-stack-protector -fno-leading-underscore -fno-omit-frame-pointer -Wall -fno-strict-aliasing -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-use-cxa-atexit -O0
+CC=/opt/osdev/bin/i386-elf-gcc -m32 -g -c -fno-stack-protector -nostdinc -fno-leading-underscore -fno-omit-frame-pointer -Wall -Werror -Wstrict-prototypes -fno-strict-aliasing -O2 -fno-builtin -I .
+CPP=/opt/osdev/bin/i386-elf-g++ -m32 -g -c -fno-stack-protector -fno-leading-underscore -fno-omit-frame-pointer -Wall -fno-strict-aliasing -nostdlib -fno-builtin -fno-rtti -fno-exceptions -fno-use-cxa-atexit -O0
PPC=$(PPC_BINARY) -n -Cn -CX -Ttyndur -Fu../lib/units -Fu../units
ASM_ELF=nasm -felf -O99
@@ -9,7 +9,7 @@ ASM_BIN=nasm -fbin -O99
BUILD_DIR=$(BUILD_ROOT)
-AS=as -32
+AS=/opt/osdev/bin/i386-elf-as -32
all:
$(MAKE) --no-print-directory -s makefiles
@@ -26,7 +26,7 @@ subdirs:
$(MAKE) --no-print-directory -sC src
clean_objs:
- rm -f *.o *.a *.mod *.ppu link.res ppas.sh tyndur
+ rm -f *.o *.a *.mod *.ppu link.res ppas.sh repo.hg
softclean: clean_objs
for file in *; do if [ -f "$$file/Makefile" -a \( ! -f "$$file/.nobuild" -o -f "$$file/.ignorenobuild" \) ]; then $(MAKE) -sC "$$file" softclean; fi done
diff --git a/src/include/types.h b/src/include/types.h
index 1ae793f..6ac4653 100644
--- a/src/include/types.h
+++ b/src/include/types.h
@@ -33,7 +33,7 @@
typedef signed long ssize_t;
-typedef void * paddr_t;
+typedef uintptr_t paddr_t;
typedef void * vaddr_t;
typedef unsigned int pid_t;
diff --git a/src/kernel/include/kernel.h b/src/kernel/include/kernel.h
index 6c0c8e4..752112c 100644
--- a/src/kernel/include/kernel.h
+++ b/src/kernel/include/kernel.h
@@ -4,19 +4,20 @@
//#define COOPERATIVE_MULTITASKING
#include <stdint.h>
+#include <types.h>
__attribute__((noreturn)) void panic(char * message, ...);
-void * phys_alloc_page(void);
-void * phys_alloc_page_range(unsigned int num);
+paddr_t phys_alloc_page(void);
+paddr_t phys_alloc_page_range(unsigned int num);
-void * phys_alloc_dma_page(void);
-void * phys_alloc_dma_page_range(unsigned int num);
+paddr_t phys_alloc_dma_page(void);
+paddr_t phys_alloc_dma_page_range(unsigned int num);
-void * phys_alloc_page_limit(uint32_t lower_limit);
+paddr_t phys_alloc_page_limit(uint32_t lower_limit);
-void phys_free_page(void * page);
-void phys_free_page_range(void * page, unsigned int num);
+void phys_free_page(paddr_t page);
+void phys_free_page_range(paddr_t page, unsigned int num);
extern void kernel_start(void);
extern void kernel_phys_start(void);
diff --git a/src/kernel/include/phys.h b/src/kernel/include/phys.h
index bfbdf2f..7d8e54f 100644
--- a/src/kernel/include/phys.h
+++ b/src/kernel/include/phys.h
@@ -1,11 +1,13 @@
#ifndef _PHYS_H_
#define _PHYS_H_
-void phys_mark_page_as_free(void * page);
+#include <types.h>
+
+void phys_mark_page_as_free(paddr_t page);
unsigned long phys_count_free_pages(void);
unsigned long phys_count_pages(void);
-void * phys_alloc_dma_page_range_64k(unsigned int num);
+paddr_t phys_alloc_dma_page_range_64k(unsigned int num);
#endif
diff --git a/src/kernel/src/debug.c b/src/kernel/src/debug.c
index a249d5d..34b51c0 100644
--- a/src/kernel/src/debug.c
+++ b/src/kernel/src/debug.c
@@ -100,7 +100,7 @@ void init_stack_backtrace(void)
int i;
/* ELF Header mappen */
- map_page_range(kernel_page_directory, elfshdr, elfshdr,
+ map_page_range(kernel_page_directory, elfshdr, (paddr_t) elfshdr,
PTE_W | PTE_P /*| PTE_U*/,
NUM_PAGES(multiboot_info.mi_elfshdr_num * sizeof(Elf32_Shdr)));
diff --git a/src/kernel/src/mm/kmm.c b/src/kernel/src/mm/kmm.c
index 0340b5b..fc38229 100644
--- a/src/kernel/src/mm/kmm.c
+++ b/src/kernel/src/mm/kmm.c
@@ -244,7 +244,7 @@ vaddr_t alloc_kernel_pages(int num)
if(!(kernel_page_tables[i] & PTE_P))
{
// Eine neue Page Table muss angelegt werden
- kernel_page_tables[i] = (uint32_t)phys_alloc_page() | PTE_W | PTE_P;
+ kernel_page_tables[i] = phys_alloc_page() | PTE_W | PTE_P;
map_kernel_page_table(i, kernel_page_tables[i]);
page_table = (page_table_t)(KERNEL_PAGE_TABLES_VADDR + (i << PAGE_SHIFT));
@@ -261,7 +261,7 @@ vaddr_t alloc_kernel_pages(int num)
for(j = (i == pgdir_index) ? pgtbl_index : 0; j < PAGE_TABLE_LENGTH && num; j++, num--)
{
- page_table[j] = (uint32_t)phys_alloc_page() | PTE_W | PTE_P;
+ page_table[j] = phys_alloc_page() | PTE_W | PTE_P;
asm volatile("invlpg %0"
: : "m" (*(char*)((i * PAGE_TABLE_LENGTH + j) * PAGE_SIZE))
: "memory");
diff --git a/src/kernel/src/mm/paging.c b/src/kernel/src/mm/paging.c
index e5db580..48f9b7e 100644
--- a/src/kernel/src/mm/paging.c
+++ b/src/kernel/src/mm/paging.c
@@ -89,16 +89,17 @@ void init_paging(void)
(uint32_t) kernel_page_directory | PTE_W | PTE_P;
// Den Kernel mappen
- map_page_range(kernel_page_directory, kernel_start, kernel_phys_start, PTE_W | PTE_P /*| PTE_U*/, ((uint32_t)kernel_end - (uint32_t)kernel_start) / PAGE_SIZE);
+ map_page_range(kernel_page_directory, kernel_start, (paddr_t) kernel_phys_start,
+ PTE_W | PTE_P /*| PTE_U*/, ((uint32_t)kernel_end - (uint32_t)kernel_start) / PAGE_SIZE);
// Videospeicher mappen
- map_page_range(kernel_page_directory, (paddr_t) 0xB8000, (vaddr_t)0xB8000, PTE_W | PTE_P /*| PTE_U*/, ((25*80*2) / PAGE_SIZE) + 1);
+ map_page_range(kernel_page_directory, (vaddr_t) 0xB8000, (paddr_t)0xB8000, PTE_W | PTE_P /*| PTE_U*/, ((25*80*2) / PAGE_SIZE) + 1);
/* Das Page Directory mappen */
- map_page(kernel_page_directory, kernel_page_directory, kernel_page_directory, PTE_P | PTE_W);
+ map_page(kernel_page_directory, kernel_page_directory, (paddr_t)kernel_page_directory, PTE_P | PTE_W);
// Bitmap mit dem physischen Speicher mappen.
- map_page_range(kernel_page_directory, phys_mmap, phys_mmap, PTE_W | PTE_P,
+ map_page_range(kernel_page_directory, phys_mmap, (paddr_t)phys_mmap, PTE_W | PTE_P,
(sizeof(uint32_t) * phys_mmap_size + PAGE_SIZE - 1) / PAGE_SIZE);
__asm__(
@@ -210,7 +211,7 @@ bool map_page(page_directory_t page_directory, vaddr_t vaddr, paddr_t paddr, int
// ihre Adresse zugreifen, wenn man nicht gerade einen Page Fault ausl� will.
// Die Page Table muss daher zun�st in den Kerneladressraum gemappt werden.
vaddr_t kernel_page_table = find_contiguous_kernel_pages(1);
- map_page(kernel_page_directory, kernel_page_table, page_table, PTE_P | PTE_W);
+ map_page(kernel_page_directory, kernel_page_table, (paddr_t) page_table, PTE_P | PTE_W);
/*
kprintf("Mappe PT in Kerneladressraum; neue PT\n");
@@ -244,7 +245,7 @@ bool map_page(page_directory_t page_directory, vaddr_t vaddr, paddr_t paddr, int
// Die Page Table muss daher zun�st in den Kerneladressraum gemappt werden.
vaddr_t kernel_page_table = find_contiguous_kernel_pages(1);
- map_page(kernel_page_directory, kernel_page_table, page_table, PTE_P | PTE_W);
+ map_page(kernel_page_directory, kernel_page_table, (paddr_t) page_table, PTE_P | PTE_W);
page_table = kernel_page_table;
}
}
@@ -291,7 +292,7 @@ bool map_page(page_directory_t page_directory, vaddr_t vaddr, paddr_t paddr, int
*/
bool unmap_page(page_directory_t page_directory, vaddr_t vaddr)
{
- return map_page(page_directory, vaddr, NULL, 0);
+ return map_page(page_directory, vaddr, (paddr_t) NULL, 0);
}
/**
@@ -322,7 +323,7 @@ static uint32_t get_pagetable_entry
} else if (page_directory[vpage / PAGE_TABLE_LENGTH] & PTE_PS) {
return page_directory[vpage / PAGE_TABLE_LENGTH];
} else {
- phys_page_table = (page_table_t)
+ phys_page_table = (paddr_t)
(page_directory[vpage / PAGE_TABLE_LENGTH] & ~0xFFF);
}
@@ -355,7 +356,7 @@ paddr_t resolve_vaddr(page_directory_t page_directory, vaddr_t vaddr)
uint32_t pte = get_pagetable_entry(page_directory, vaddr);
if ((pte & PTE_P) == 0) {
- return NULL;
+ return (paddr_t) NULL;
}
if ((pte & PTE_PS) == 0) {
@@ -416,7 +417,7 @@ vaddr_t find_contiguous_pages(page_directory_t page_directory, int num, uint32_t
page_table_t page_table;
vaddr_t kernel_page_table = find_contiguous_kernel_pages(1);
- map_page(kernel_page_directory, kernel_page_table, (vaddr_t) (page_directory[cur_page_table] & PAGE_MASK), PTE_P | PTE_W);
+ map_page(kernel_page_directory, kernel_page_table, page_directory[cur_page_table] & PAGE_MASK, PTE_P | PTE_W);
page_table = kernel_page_table;
while (cur_page < PAGE_TABLE_LENGTH) {
@@ -459,7 +460,7 @@ void increase_user_stack_size(struct task * task_ptr, int pages)
for(i = 0; i < pages; i++)
{
task_ptr->user_stack_bottom -= PAGE_SIZE;
- if(resolve_vaddr((page_directory_t) task_ptr->cr3, (vaddr_t) task_ptr->user_stack_bottom) != NULL)
+ if(resolve_vaddr((page_directory_t) task_ptr->cr3, (vaddr_t) task_ptr->user_stack_bottom) != (paddr_t) NULL)
{
kprintf("\n"
"\033[1;37m\033[41m" // weiss auf rot
diff --git a/src/kernel/src/mm/phys.c b/src/kernel/src/mm/phys.c
index 9d4fea6..f0154da 100644
--- a/src/kernel/src/mm/phys.c
+++ b/src/kernel/src/mm/phys.c
@@ -95,10 +95,10 @@ unsigned long phys_count_pages()
* @param page Zeiger auf den Anfang der Page die als frei markiert werden soll.
*/
-void phys_mark_page_as_free(void * page)
+void phys_mark_page_as_free(paddr_t page)
{
// kprintf("[Free %08x]", page);
- phys_mmap[(unsigned int)page / PAGE_SIZE / 32] |= 1 << (((unsigned int)page / PAGE_SIZE) & 31);
+ phys_mmap[page / PAGE_SIZE / 32] |= 1 << ((page / PAGE_SIZE) & 31);
}
/**
@@ -108,13 +108,13 @@ void phys_mark_page_as_free(void * page)
* @param num Anzahl der Pages die als frei markiert werden sollen.
*/
-void phys_mark_page_range_as_free(void * page, unsigned int num)
+void phys_mark_page_range_as_free(paddr_t page, unsigned int num)
{
int i;
for(i = 0; i < num; i++)
{
- phys_mark_page_as_free((void*)((char*)page + i * PAGE_SIZE));
+ phys_mark_page_as_free(page + i * PAGE_SIZE);
}
}
@@ -124,9 +124,9 @@ void phys_mark_page_range_as_free(void * page, unsigned int num)
* @param page Zeiger auf den Anfang der Page die als benutzt markiert werden soll.
*/
-void phys_mark_page_as_used(void * page)
+void phys_mark_page_as_used(paddr_t page)
{
- phys_mmap[(unsigned int)page / PAGE_SIZE / 32] &= ~(1 << (((unsigned int)page / PAGE_SIZE) & 31));
+ phys_mmap[page / PAGE_SIZE / 32] &= ~(1 << ((page / PAGE_SIZE) & 31));
}
/**
@@ -136,13 +136,13 @@ void phys_mark_page_as_used(void * page)
* @param num Anzahl der Pages die als benutzt markiert werden sollen.
*/
-void phys_mark_page_range_as_used(void * page, unsigned int num)
+void phys_mark_page_range_as_used(paddr_t page, unsigned int num)
{
int i;
for(i = 0; i < num; i++)
{
- phys_mark_page_as_used((void*)((char*)page + i * PAGE_SIZE));
+ phys_mark_page_as_used(page + i * PAGE_SIZE);
}
}
@@ -156,16 +156,16 @@ void phys_mark_page_range_as_used(void * page, unsigned int num)
* durch PAGE_SIZE teilbar). Im Fehlerfall wird 1 zur�eben.
*/
-void * find_free_page(unsigned long lower_limit)
+paddr_t find_free_page(unsigned long lower_limit)
{
unsigned int i, j;
- void * page = 0;
-
+ paddr_t page = 0;
+
i = lower_limit / PAGE_SIZE / 32;
if(phys_mmap[i] & (0xffffffff << ((lower_limit / PAGE_SIZE) % 32)))
{
j = bit_scan_forward(phys_mmap[i] & (0xffffffff << ((lower_limit / PAGE_SIZE) % 32)));
- page = (void*)((i * 32 + j) * PAGE_SIZE);
+ page = (i * 32 + j) * PAGE_SIZE;
return page;
}
@@ -174,12 +174,12 @@ void * find_free_page(unsigned long lower_limit)
if(phys_mmap[i])
{
j = bit_scan_forward(phys_mmap[i]);
- page = (void*)((i * 32 + j) * PAGE_SIZE);
+ page = (i * 32 + j) * PAGE_SIZE;
return page;
}
}
- return (void *) 1;
+ return 1;
}
/**
@@ -196,11 +196,11 @@ void * find_free_page(unsigned long lower_limit)
*/
/* TODO: unbedingt testen */
-void * find_free_page_range(unsigned long lower_limit, unsigned int num)
+paddr_t find_free_page_range(unsigned long lower_limit, unsigned int num)
{
unsigned int i, j;
unsigned int found = 0;
- void * page = 0;
+ paddr_t page = 0;
for(i = lower_limit / PAGE_SIZE / 32; i < phys_mmap_size; i++)
{
@@ -214,7 +214,7 @@ void * find_free_page_range(unsigned long lower_limit, unsigned int num)
{
if(found == 0)
{
- page = (void*)(i * 32 * PAGE_SIZE);
+ page = i * 32 * PAGE_SIZE;
}
found += 32;
}
@@ -226,7 +226,7 @@ void * find_free_page_range(unsigned long lower_limit, unsigned int num)
{
if(found == 0)
{
- page = (void*)((i * 32 + j) * PAGE_SIZE);
+ page = (i * 32 + j) * PAGE_SIZE;
}
found++;
@@ -248,7 +248,7 @@ void * find_free_page_range(unsigned long lower_limit, unsigned int num)
}
}
- return (void*) 1;
+ return 1;
}
/**
@@ -257,7 +257,7 @@ void * find_free_page_range(unsigned long lower_limit, unsigned int num)
* @param page Zeiger auf den Anfang der Page die als frei markiert werden soll.
*/
-void phys_free_page(void * page)
+void phys_free_page(paddr_t page)
{
phys_mark_page_as_free(page);
}
@@ -269,7 +269,7 @@ void phys_free_page(void * page)
* @param num Anzahl der Pages die als frei markiert werden sollen.
*/
-void phys_free_page_range(void * page, unsigned int num)
+void phys_free_page_range(paddr_t page, unsigned int num)
{
phys_mark_page_range_as_free(page, num);
}
@@ -280,10 +280,10 @@ void phys_free_page_range(void * page, unsigned int num)
* @return Zeiger auf den Anfang der DMA-Page.
*/
-void * phys_alloc_dma_page()
+paddr_t phys_alloc_dma_page()
{
- void * page = find_free_page(0);
- if((uint32_t) page & (PAGE_SIZE - 1))
+ paddr_t page = find_free_page(0);
+ if(page & (PAGE_SIZE - 1))
{
panic("Kein freier Speicher mehr da.");
}
@@ -297,10 +297,10 @@ void * phys_alloc_dma_page()
* @return Zeiger auf den Anfang der Page.
*/
-void * phys_alloc_page()
+paddr_t phys_alloc_page()
{
- void * page = find_free_page(16 * 1024 * 1024);
- if((uint32_t) page & (PAGE_SIZE - 1))
+ paddr_t page = find_free_page(16 * 1024 * 1024);
+ if(page & (PAGE_SIZE - 1))
{
return phys_alloc_dma_page();
}
@@ -311,15 +311,15 @@ void * phys_alloc_page()
/**
* Reserviert eine Page nicht unterhalb einer gegebenen Adresse
*/
-void * phys_alloc_page_limit(uint32_t lower_limit)
+paddr_t phys_alloc_page_limit(uint32_t lower_limit)
{
- void * page = find_free_page(16 * 1024 * 1024 > lower_limit ? 16 * 1024 * 1024 : lower_limit);
+ paddr_t page = find_free_page(16 * 1024 * 1024 > lower_limit ? 16 * 1024 * 1024 : lower_limit);
- if((uint32_t) page & (PAGE_SIZE - 1)) {
+ if(page & (PAGE_SIZE - 1)) {
page = find_free_page(lower_limit);
}
- if((uint32_t) page & (PAGE_SIZE - 1)) {
+ if(page & (PAGE_SIZE - 1)) {
panic("Konnte Speicher nicht reservieren");
}
phys_mark_page_as_used(page);
@@ -333,9 +333,9 @@ void * phys_alloc_page_limit(uint32_t lower_limit)
* @return Zeiger auf den Anfang der ersten Page.
*/
-void * phys_alloc_dma_page_range(unsigned int num)
+paddr_t phys_alloc_dma_page_range(unsigned int num)
{
- void * page = find_free_page_range(0, num);
+ paddr_t page = find_free_page_range(0, num);
if((uint32_t) page & (PAGE_SIZE - 1))
{
panic("Keine freier Speicher mehr da.");
@@ -350,9 +350,9 @@ void * phys_alloc_dma_page_range(unsigned int num)
* @return Zeiger auf den Anfang der ersten Page.
*/
-void * phys_alloc_page_range(unsigned int num)
+paddr_t phys_alloc_page_range(unsigned int num)
{
- void * page = find_free_page_range(16 * 1024 * 1024, num);
+ paddr_t page = find_free_page_range(16 * 1024 * 1024, num);
if((uint32_t) page & (PAGE_SIZE - 1))
{
return phys_alloc_dma_page_range(num);
@@ -367,16 +367,16 @@ void * phys_alloc_page_range(unsigned int num)
* @return Zeiger auf den Anfang der ersten Page.
*/
-void * phys_alloc_dma_page_range_64k(unsigned int num)
+paddr_t phys_alloc_dma_page_range_64k(unsigned int num)
{
uint32_t pos = 0;
- void* page;
+ paddr_t page;
- while(1)
+ while(1)
{
page = find_free_page_range(pos, num);
- if((uint32_t) page & (PAGE_SIZE - 1))
+ if(page & (PAGE_SIZE - 1))
{
panic("Keine freier Speicher mehr da.");
}
@@ -588,12 +588,12 @@ void init_phys_mem(vaddr_t mmap_addr, uint32_t mmap_length, uint32_t upper_mem)
}
/* alle seiten als belegt markieren */
- phys_mark_page_range_as_used((void*)0, upper_end / PAGE_SIZE);
+ phys_mark_page_range_as_used(0, upper_end / PAGE_SIZE);
/* freie seiten als frei markieren */
for(i = 0; i < memblocks_count; i++)
{
//kprintf("Mark as free: %x, %d Pages\n", available_memory[i].start, (available_memory[i].end - available_memory[i].start) / PAGE_SIZE);
- phys_mark_page_range_as_free((void*)available_memory[i].start, (available_memory[i].end - available_memory[i].start) / PAGE_SIZE);
+ phys_mark_page_range_as_free(available_memory[i].start, (available_memory[i].end - available_memory[i].start) / PAGE_SIZE);
}
}
diff --git a/src/kernel/src/modules.c b/src/kernel/src/modules.c
index 2eeeb92..d05b10b 100644
--- a/src/kernel/src/modules.c
+++ b/src/kernel/src/modules.c
@@ -90,10 +90,11 @@ void load_init_module(struct multiboot_info * multiboot_info)
}
//Befehlszeile des Moduls mappen
- char* cmdline = map_phys_addr(multiboot_module->cmdline, 4096);
+ char* cmdline = map_phys_addr((paddr_t) multiboot_module->cmdline, 4096);
//Das Modul dem ELF-Loader uebergeben
- void* elf_image = map_phys_addr(multiboot_module->start, multiboot_module->end - multiboot_module->start);
+ void* elf_image = map_phys_addr((paddr_t) multiboot_module->start,
+ multiboot_module->end - multiboot_module->start);
load_single_module(elf_image, cmdline);
free_phys_addr(elf_image, multiboot_module->end - multiboot_module->start);
@@ -132,17 +133,17 @@ void load_multiboot_modules(struct multiboot_info * multiboot_info)
multiboot_module_phys = multiboot_info->mi_mods_addr;
// Speicher f� Modulparameter
- char* mod_cmdline_page = phys_alloc_page();
+ paddr_t mod_cmdline_page_phys = phys_alloc_page();
void* mod_cmdline_task = find_contiguous_pages((page_directory_t)first_task->cr3, 1, USER_MEM_START, USER_MEM_END);
- map_page((page_directory_t)first_task->cr3, mod_cmdline_task, mod_cmdline_page, PTE_P | PTE_U | PTE_W);
+ map_page((page_directory_t)first_task->cr3, mod_cmdline_task, mod_cmdline_page_phys, PTE_P | PTE_U | PTE_W);
- mod_cmdline_page = map_phys_addr(mod_cmdline_page, PAGE_SIZE);
+ char* mod_cmdline_page = map_phys_addr(mod_cmdline_page_phys, PAGE_SIZE);
char* mod_cmdline = mod_cmdline_page;
size_t mod_cmdline_free = PAGE_SIZE;
//Speicher f� Modulliste allokieren und
void* mod_list_task = find_contiguous_pages((page_directory_t)first_task->cr3, 1, USER_MEM_START, USER_MEM_END);
- void* mod_list_phys = phys_alloc_page();
+ paddr_t mod_list_phys = phys_alloc_page();
map_page((page_directory_t)first_task->cr3, mod_list_task, mod_list_phys, PTE_P | PTE_U | PTE_W);
@@ -168,7 +169,7 @@ void load_multiboot_modules(struct multiboot_info * multiboot_info)
//Freie virtuelle Adresse suchen um das Modul dort hin zu mappen.
void* dest = find_contiguous_pages((page_directory_t)first_task->cr3, pages, USER_MEM_START, USER_MEM_END);
- map_page_range((page_directory_t)first_task->cr3, dest, multiboot_module->start, PTE_P | PTE_U | PTE_W, pages);
+ map_page_range((page_directory_t)first_task->cr3, dest, (paddr_t) multiboot_module->start, PTE_P | PTE_U | PTE_W, pages);
first_task->memory_used += pages * 0x1000;
//TODO: Den Speicher aus dem Kerneladressraum unmappen
@@ -179,7 +180,7 @@ void load_multiboot_modules(struct multiboot_info * multiboot_info)
modulelist[3 + (3*i)] = (uint32_t) mod_cmdline_task + (mod_cmdline - mod_cmdline_page);
// Modellbefehlszeile kopieren
- char* cmdline = map_phys_addr(multiboot_module->cmdline, 4096);
+ char* cmdline = map_phys_addr((paddr_t) multiboot_module->cmdline, 4096);
size_t length = strlen(cmdline);
if (mod_cmdline_free > length) {
strncpy(mod_cmdline, cmdline, length);
@@ -356,7 +357,7 @@ void load_single_module(Elf32_Ehdr * elf_header, const char* cmdline)
#endif
memset(dst, 0, 0x1000);
- free_phys_addr(phys_dst, 0x1000);
+ free_phys_addr((vaddr_t)phys_dst, 0x1000);
}
#ifdef DEBUG
diff --git a/src/kernel/src/rpc.c b/src/kernel/src/rpc.c
index 22863e3..45887e1 100644
--- a/src/kernel/src/rpc.c
+++ b/src/kernel/src/rpc.c
@@ -165,8 +165,8 @@ bool fastrpc(struct task * callee, uint32_t metadata_size, void* metadata,
pages_count++;
}
- if(resolve_vaddr((page_directory_t) callee->cr3,
- (vaddr_t) callee_isf->esp - rounded_data_size) == NULL)
+ if(resolve_vaddr((page_directory_t) callee->cr3,
+ (vaddr_t) callee_isf->esp - rounded_data_size) == (paddr_t) NULL)
{
// TODO Das k�e bis zu (pages_count - 1) Pages zu viel reservieren
increase_user_stack_size(callee, pages_count);
diff --git a/src/kernel/src/syscall.c b/src/kernel/src/syscall.c
index 89a2935..5161f84 100644
--- a/src/kernel/src/syscall.c
+++ b/src/kernel/src/syscall.c
@@ -148,7 +148,7 @@ void syscall(struct int_stack_frame ** esp)
while(num--)
{
paddr = phys_alloc_page();
- *phys = NULL;
+ *phys = (paddr_t) NULL;
if (!map_page((page_directory_t) current_task->cr3, vaddr, paddr, PTE_P | PTE_U | PTE_W))
{
@@ -230,7 +230,7 @@ void syscall(struct int_stack_frame ** esp)
}
else
{
- phys_mark_page_as_free((void*) paddress);
+ phys_mark_page_as_free(paddress);
}
address += PAGE_SIZE;
@@ -426,7 +426,7 @@ void syscall(struct int_stack_frame ** esp)
map_page(new_task_pd, dest, phys_alloc_page(), PTE_P | PTE_U | PTE_W);
}
- void *phys_addr = resolve_vaddr(new_task_pd, dest);
+ paddr_t phys_addr = resolve_vaddr(new_task_pd, dest);
char *destmem = find_contiguous_kernel_pages(1);
map_page(kernel_page_directory, destmem, phys_addr, PTE_P | PTE_W);
memcpy(destmem, src, 0x1000);
diff --git a/src/kernel/src/vm86.c b/src/kernel/src/vm86.c
index 08aec99..be50e39 100644
--- a/src/kernel/src/vm86.c
+++ b/src/kernel/src/vm86.c
@@ -157,8 +157,8 @@ struct task * create_vm86_task(uint16_t interrupt, vm86_regs_t *regs, uint32_t *
new_task->cr3 = pagedir;
pagedir[0] |= 0x4;
- map_page_range(kernel_page_directory, (paddr_t)0xC0000, (vaddr_t)0xC0000, PTE_P | PTE_U, 0x40);
- map_page_range(kernel_page_directory, (paddr_t)0xA0000, (vaddr_t)0xA0000, PTE_W | PTE_P | PTE_U, 0x10);
+ map_page_range(kernel_page_directory, (vaddr_t)0xC0000, (paddr_t)0xC0000, PTE_P | PTE_U, 0x40);
+ map_page_range(kernel_page_directory, (vaddr_t)0xA0000, (paddr_t)0xA0000, PTE_W | PTE_P | PTE_U, 0x10);
// Speicher fuer die Stacks allokieren
@@ -284,13 +284,13 @@ bool vm86_exception(uint32_t *esp)
vm86_info_t *info = task->vm86_info;
// Speicher kopieren
if (info->meminfo) {
- uint32_t *phys_meminfo = resolve_vaddr(task->parent_task->cr3, (uint32_t*)((uint32_t)info->meminfo & ~0xFFF));
+ paddr_t phys_meminfo = resolve_vaddr(task->parent_task->cr3, (uint32_t*)((uint32_t)info->meminfo & ~0xFFF));
uint32_t *meminfo = (uint32_t*)find_contiguous_kernel_pages(1);
map_page(kernel_page_directory, meminfo, phys_meminfo, PTE_P | PTE_W);
meminfo = (uint32_t*)(((uint32_t)meminfo) + ((uint32_t)info->meminfo & 0xFFF));
uint32_t i;
for (i = 0; i < meminfo[0]; i++) {
- uint32_t *phys_mem = resolve_vaddr(task->parent_task->cr3, (uint32_t*)((uint32_t)meminfo[1 + i * 3 + 1] & ~0xFFF));
+ paddr_t phys_mem = resolve_vaddr(task->parent_task->cr3, (uint32_t*)((uint32_t)meminfo[1 + i * 3 + 1] & ~0xFFF));
uint32_t *mem = (uint32_t*)find_contiguous_kernel_pages(1);
map_page(kernel_page_directory, mem, phys_mem, PTE_P | PTE_W);
memcpy((void*)((uint32_t)mem + (meminfo[1 + i * 3 + 1] & 0xFFF)), (void*)meminfo[1 + i * 3], meminfo[1 + i * 3 + 2]);
@@ -300,7 +300,7 @@ bool vm86_exception(uint32_t *esp)
unmap_page(kernel_page_directory, (uint32_t*)((uint32_t)meminfo & ~0xFFF));
}
// Register speichern
- uint32_t *phys_regs = resolve_vaddr(task->parent_task->cr3, (uint32_t*)((uint32_t)info->regs & ~0xFFF));
+ paddr_t phys_regs = resolve_vaddr(task->parent_task->cr3, (uint32_t*)((uint32_t)info->regs & ~0xFFF));
uint32_t regs = (uint32_t) map_phys_addr(phys_regs, PAGE_SIZE);
vm86_regs_t * vm86_regs = (vm86_regs_t *)(regs + ((uint32_t)info->regs & 0xFFF));
vm86_regs->ax = isf->eax;
@@ -311,13 +311,13 @@ bool vm86_exception(uint32_t *esp)
vm86_regs->di = isf->edi;
vm86_regs->ds = ((uint32_t*)(isf + 1))[0];
vm86_regs->es = ((uint32_t*)(isf + 1))[1];
- free_phys_addr((void*) regs, PAGE_SIZE);
+ free_phys_addr((vaddr_t) regs, PAGE_SIZE);
// Speicher freigeben
// - Stack
unmap_page(task->cr3, (vaddr_t)0x90000);
// - BIOS-Daten
uint32_t *page_table = (uint32_t*)find_contiguous_kernel_pages(1);
- map_page(kernel_page_directory, page_table, (uint32_t*)(((uint32_t*)task->cr3)[0] & ~0xFFF), PTE_P | PTE_W);
+ map_page(kernel_page_directory, page_table, (((uint32_t*)task->cr3)[0] & ~0xFFF), PTE_P | PTE_W);
page_table[0] = 0;
unmap_page(kernel_page_directory, page_table);
// - BIOS
diff --git a/src/kernel2/include/arch/i386/mm_arch.h b/src/kernel2/include/arch/i386/mm_arch.h
index ef01a25..cac9e9b 100644
--- a/src/kernel2/include/arch/i386/mm_arch.h
+++ b/src/kernel2/include/arch/i386/mm_arch.h
@@ -37,6 +37,7 @@
#define _MM_ARCH_H_
#include <stdint.h>
+#include <types.h>
#include <lock.h>
#include <page.h>
#include "multiboot.h"
@@ -59,7 +60,7 @@ typedef unsigned long* page_directory_t;
typedef struct {
uint32_t version;
- page_directory_t page_directory;
+ paddr_t page_directory;
page_directory_t page_directory_virt;
lock_t lock;
} mmc_context_t;
diff --git a/src/kernel2/src/arch/i386/gdt.c b/src/kernel2/src/arch/i386/gdt.c
index 4b85a7a..9d5b591 100644
--- a/src/kernel2/src/arch/i386/gdt.c
+++ b/src/kernel2/src/arch/i386/gdt.c
@@ -118,7 +118,7 @@ void gdt_init(void)
void gdt_init_local(void)
{
int i;
- void* pagetable;
+ paddr_t pagetable;
lock(&gdt_lock);
// Deskriptor fuer das Task state segment anlegen
diff --git a/src/kernel2/src/arch/i386/mm/mm_context.c b/src/kernel2/src/arch/i386/mm/mm_context.c
index 22a58e5..f810fa0 100644
--- a/src/kernel2/src/arch/i386/mm/mm_context.c
+++ b/src/kernel2/src/arch/i386/mm/mm_context.c
@@ -100,10 +100,10 @@ mmc_context_t mmc_create_kernel_context()
{
mmc_context_t context;
// Das Page Directory initialisieren
- page_directory_t page_directory = pmm_alloc(1);
+ page_directory_t page_directory = (page_directory_t) pmm_alloc(1);
context.lock = LOCK_UNLOCKED;
- context.page_directory = page_directory;
+ context.page_directory = (paddr_t) page_directory;
context.page_directory_virt = page_directory;
context.version = page_directory_version;
@@ -216,7 +216,7 @@ static inline vaddr_t get_pagetable(mmc_context_t* context, size_t index)
}
} else {
page_table = vmm_kernel_automap
- ((vaddr_t) (pagedir[index] & PAGE_MASK), PAGE_SIZE);
+ ((paddr_t) (pagedir[index] & PAGE_MASK), PAGE_SIZE);
}
return page_table;
@@ -429,7 +429,7 @@ bool mmc_unmap(mmc_context_t* context, vaddr_t vaddr, size_t count)
size_t i;
for (i = 0; i < count; i++) {
- if (!map_page(context, vaddr + i * PAGE_SIZE, NULL, 0)) {
+ if (!map_page(context, vaddr + i * PAGE_SIZE, (paddr_t) NULL, 0)) {
return false;
}
}
@@ -458,7 +458,7 @@ paddr_t mmc_resolve(mmc_context_t* context, vaddr_t vaddr)
// Bei einer 4M-Page sind wir eigentlich schon am Ziel
if ((page_directory[vpage / PAGE_TABLE_LENGTH] & PTE_P) == 0)
{
- return NULL;
+ return (paddr_t) NULL;
}
else if (page_directory[vpage / PAGE_TABLE_LENGTH] & PTE_PS)
{
@@ -469,8 +469,7 @@ paddr_t mmc_resolve(mmc_context_t* context, vaddr_t vaddr)
}
else
{
- phys_page_table = (page_table_t)
- (page_directory[vpage / PAGE_TABLE_LENGTH] & ~0xFFF);
+ phys_page_table = (page_directory[vpage / PAGE_TABLE_LENGTH] & ~0xFFF);
}
// Die Page-Table-Adresse ist eine physische Adresse. Am sichersten ist es,
@@ -485,7 +484,7 @@ paddr_t mmc_resolve(mmc_context_t* context, vaddr_t vaddr)
| ((uint32_t) vaddr & 0xFFF));
} else {
- result = NULL;
+ result = (paddr_t) NULL;
}
// Falls wir die Page Table extra in den Kerneladressraum gemappt haben,
@@ -716,10 +715,10 @@ inline vaddr_t mmc_valloc_limits(mmc_context_t* context, size_t num_pages,
vaddr_t mmc_valloc(mmc_context_t* context, size_t num_pages, int flags)
{
if (flags & PTE_U) {
- return mmc_valloc_limits(context, num_pages, NULL, NULL,
+ return mmc_valloc_limits(context, num_pages, 0, 0,
MM_USER_START, MM_USER_END, flags);
} else {
- return mmc_valloc_limits(context, num_pages, NULL, NULL,
+ return mmc_valloc_limits(context, num_pages, 0, 0,
KERNEL_MEM_START, KERNEL_MEM_END, flags);
}
}
diff --git a/src/kernel2/src/arch/i386/mm/virt.c b/src/kernel2/src/arch/i386/mm/virt.c
index a656a1a..c0181fa 100644
--- a/src/kernel2/src/arch/i386/mm/virt.c
+++ b/src/kernel2/src/arch/i386/mm/virt.c
@@ -57,10 +57,10 @@ void vmm_init(mmc_context_t* kernel_context)
// TODO: 4M-Pages benutzen, wenn in config.h aktiviert
// Den Kernel mappen
- mmc_map(kernel_context, kernel_start, kernel_phys_start, PTE_P,
+ mmc_map(kernel_context, kernel_start, (paddr_t) kernel_phys_start, PTE_P,
NUM_PAGES(rosize));
mmc_map(kernel_context, kernel_start + rosize,
- kernel_phys_start + rosize, PTE_P | PTE_W, NUM_PAGES(rwsize));
+ (paddr_t) kernel_phys_start + rosize, PTE_P | PTE_W, NUM_PAGES(rwsize));
// Videospeicher mappen
// TODO Usermodus muss die momentan wegen VM86 sehen. Waere wohl besser,
@@ -81,7 +81,7 @@ void vmm_init(mmc_context_t* kernel_context)
// Hier daft _NICHT vmm_kernel_automap_ benutzt werden, da use_phys_addr
// hier noch true ist.
- phys_mmap = mmc_automap(kernel_context, phys_mmap,
+ phys_mmap = mmc_automap(kernel_context, (paddr_t) phys_mmap,
NUM_PAGES(phys_mmap_size), KERNEL_MEM_START, KERNEL_MEM_END, PTE_P |
PTE_W);
pmm_set_bitmap_start(phys_mmap);
@@ -129,7 +129,7 @@ void vmm_init_local(mmc_context_t* kernel_context)
vaddr_t vmm_kernel_automap(paddr_t start, size_t size)
{
if (use_phys_addr == true) {
- return start;
+ return (vaddr_t) start;
} else {
return (vaddr_t) ((uintptr_t) mmc_automap(&mmc_current_context(),
(paddr_t) ((uintptr_t) start & PAGE_MASK), NUM_PAGES(size),
@@ -173,7 +173,7 @@ void increase_user_stack_size(pm_thread_t* thread, int pages)
{
thread->user_stack_bottom -= PAGE_SIZE;
if(mmc_resolve(&thread->process->context,
- (vaddr_t) thread->user_stack_bottom) != NULL)
+ (vaddr_t) thread->user_stack_bottom) != (paddr_t) NULL)
{
/*
kprintf("\n"
diff --git a/src/kernel2/src/arch/i386/vm86.c b/src/kernel2/src/arch/i386/vm86.c
index ce216e8..3594378 100644
--- a/src/kernel2/src/arch/i386/vm86.c
+++ b/src/kernel2/src/arch/i386/vm86.c
@@ -88,7 +88,7 @@ static struct {
static struct {
bool in_use;
void* stack;
- void* nullpage;
+ paddr_t nullpage;
uint32_t* memory;
pm_thread_t* caller;
vm86_regs_t* regs;
@@ -187,13 +187,13 @@ int arch_vm86(uint8_t intr, void* regs, uint32_t* memory)
// Nullpage mappen
uint32_t* page_table = (uint32_t*) PAGETABLES_MEM_START;
- void* nullpage = pmm_alloc(1);
+ paddr_t nullpage = pmm_alloc(1);
page_table[0] = (uintptr_t) nullpage | PTE_U | PTE_W | PTE_P;
asm volatile("invlpg %0" :: "m" (*(char*)0x0));
memcpy(0, &bios_data, 4096);
// Stack mappen
- void* stack = mmc_valloc_limits(&mmc_current_context(), 1, NULL, NULL,
+ void* stack = mmc_valloc_limits(&mmc_current_context(), 1, 0, 0,
0x0, 0x9fc00, PTE_U | PTE_W | PTE_P);
if (stack == NULL) {
kprintf("vm86: Kein Platz fuer den Stack\n");
diff --git a/src/kernel2/src/interrupts/apic.c b/src/kernel2/src/interrupts/apic.c
index 924a165..c606a12 100644
--- a/src/kernel2/src/interrupts/apic.c
+++ b/src/kernel2/src/interrupts/apic.c
@@ -101,7 +101,7 @@ void apic_init()
if (apic_base_virt == 0) {
apic_base_phys = (paddr_t) (uintptr_t) (cpu_read_msr(APIC_BASE_MSR) &
(~0xFFF));
- apic_base_virt = apic_base_phys;
+ apic_base_virt = (vaddr_t) apic_base_phys;
}
// Jetzt wird der APIC aktiviert
diff --git a/src/kernel2/src/mm/phys.c b/src/kernel2/src/mm/phys.c
index 8717c7b..305041e 100644
--- a/src/kernel2/src/mm/phys.c
+++ b/src/kernel2/src/mm/phys.c
@@ -127,7 +127,7 @@ size_t pmm_count_pages()
* soll.
*/
-static inline void phys_mark_page_as_free(void* page)
+static inline void phys_mark_page_as_free(paddr_t page)
{
//lock(&pmm_lock);
size_t bitmap_index = (size_t) page / PAGE_SIZE / PMM_BITS_PER_ELEMENT;
@@ -144,7 +144,7 @@ static inline void phys_mark_page_as_free(void* page)
* @param num Anzahl der Pages die als frei markiert werden sollen.
*/
-static inline void phys_mark_page_range_as_free(void* page, size_t num)
+static inline void phys_mark_page_range_as_free(paddr_t page, size_t num)
{
size_t i;
@@ -160,7 +160,7 @@ static inline void phys_mark_page_range_as_free(void* page, size_t num)
* soll.
*/
-static inline void phys_mark_page_as_used(void* page)
+static inline void phys_mark_page_as_used(paddr_t page)
{
//lock(&pmm_lock);
size_t bitmap_index = (size_t) page / PAGE_SIZE / PMM_BITS_PER_ELEMENT;
@@ -176,7 +176,7 @@ static inline void phys_mark_page_as_used(void* page)
* @param num Anzahl der Pages die als benutzt markiert werden sollen.
*/
-static inline void phys_mark_page_range_as_used(void* page, size_t num)
+static inline void phys_mark_page_range_as_used(paddr_t page, size_t num)
{
size_t i;
@@ -200,12 +200,12 @@ static inline void phys_mark_page_range_as_used(void* page, size_t num)
*/
/* TODO: unbedingt testen */
-static void* find_free_page_range
+static paddr_t find_free_page_range
(size_t lower_index, size_t upper_index, size_t num)
{
size_t i, j;
size_t found = 0;
- void* page = 0;
+ paddr_t page = 0;
for(i = lower_index; i < upper_index; i++)
{
@@ -218,7 +218,7 @@ static void* find_free_page_range
{
if(found == 0)
{
- page = (void*)(i * PMM_BITS_PER_ELEMENT * PAGE_SIZE);
+ page = i * PMM_BITS_PER_ELEMENT * PAGE_SIZE;
}
found += PMM_BITS_PER_ELEMENT;
}
@@ -229,8 +229,7 @@ static void* find_free_page_range
if(pmm_bitmap[i] & (1 << j))
{
if(found == 0) {
- page = (void*)
- ((i * PMM_BITS_PER_ELEMENT + j) * PAGE_SIZE);
+ page = (i * PMM_BITS_PER_ELEMENT + j) * PAGE_SIZE;
}
found++;
@@ -250,7 +249,7 @@ static void* find_free_page_range
}
}
- return (void*) 1;
+ return 1;
}
@@ -314,8 +313,8 @@ paddr_t pmm_alloc_limits(paddr_t lower_limit, paddr_t upper_limit, size_t num)
paddr_t pmm_alloc(size_t num)
{
paddr_t result = pmm_alloc_limits(
- 0,
- (void*) (pmm_bitmap_length * PMM_BITS_PER_ELEMENT * PAGE_SIZE),
+ 0,
+ pmm_bitmap_length * PMM_BITS_PER_ELEMENT * PAGE_SIZE,
num
);
@@ -410,16 +409,16 @@ static struct mem_block get_reserved_block
// Bitmap nur beruecksichtigen, wenn sie bereits zugewiesen ist
if (bitmap && (i-- == 0)) {
- result.start = pmm_bitmap;
- result.end = pmm_bitmap +
- ((pmm_bitmap_length / 8) * PMM_BITS_PER_ELEMENT);
+ result.start = (paddr_t) pmm_bitmap;
+ result.end = (paddr_t)
+ (pmm_bitmap + ((pmm_bitmap_length / 8) * PMM_BITS_PER_ELEMENT));
return result;
}
// Der Kernel ist besetzt
if (i-- == 0) {
- result.start = kernel_phys_start;
- result.end = kernel_phys_end;
+ result.start = (paddr_t) kernel_phys_start;
+ result.end = (paddr_t) kernel_phys_end;
return result;
}
@@ -434,26 +433,24 @@ static struct mem_block get_reserved_block
{
// Die Multiboot-Info zum Modul
if (i-- == 0) {
- result.start = multiboot_module;
- result.end = multiboot_module + 1;
+ result.start = (paddr_t) multiboot_module;
+ result.end = (paddr_t) (multiboot_module + 1);
return result;
}
// Das Modul selbst
if (i-- == 0) {
- result.start = (paddr_t) (uintptr_t) multiboot_module->start;
- result.end = (paddr_t) (uintptr_t) multiboot_module->end;
+ result.start = (paddr_t) multiboot_module->start;
+ result.end = (paddr_t) multiboot_module->end;
return result;
}
// Die Kommandozeile des Moduls
if (multiboot_module->cmdline) {
if (i-- == 0) {
- result.start = (paddr_t) (uintptr_t) multiboot_module->
- cmdline;
- result.end = (paddr_t) (uintptr_t) multiboot_module->
- cmdline + strlen((char*) (uintptr_t) multiboot_module->
- cmdline);
+ result.start = (paddr_t) multiboot_module->cmdline;
+ result.end = (paddr_t) multiboot_module->cmdline +
+ strlen((char*) (uintptr_t) multiboot_module->cmdline);
return result;
}
}
@@ -564,7 +561,7 @@ void pmm_init(struct multiboot_info* multiboot_info)
{
// Finde einen Platz f� Bitmap
size_t bitmap_size = required_bitmap_size(multiboot_info);
- pmm_bitmap = find_bitmap_mem(multiboot_info, bitmap_size);
+ pmm_bitmap = (void*) find_bitmap_mem(multiboot_info, bitmap_size);
pmm_bitmap_length = 8 * bitmap_size / PMM_BITS_PER_ELEMENT;
// Am Anfang ist alles besetzt
diff --git a/src/kernel2/src/syscalls/pm.c b/src/kernel2/src/syscalls/pm.c
index a3025cb..806e827 100644
--- a/src/kernel2/src/syscalls/pm.c
+++ b/src/kernel2/src/syscalls/pm.c
@@ -187,7 +187,7 @@ void syscall_init_child_page(pid_t pid, vaddr_t dest, vaddr_t src, size_t size)
paddr_t dest_phys = mmc_resolve(&process->context, dest_cur);
paddr_t src_phys = mmc_resolve(&mmc_current_context(), src_cur);
- if (dest_phys != NULL) {
+ if (dest_phys != (paddr_t) NULL) {
// Die Page temporaer mappen
vaddr_t dest_vaddr = vmm_kernel_automap(dest_phys, PAGE_SIZE);
memcpy(dest_vaddr, src_cur, PAGE_SIZE);
diff --git a/src/kernel2/src/syscalls/rpc.c b/src/kernel2/src/syscalls/rpc.c
index 2f1e1bc..382c882 100644
--- a/src/kernel2/src/syscalls/rpc.c
+++ b/src/kernel2/src/syscalls/rpc.c
@@ -85,7 +85,7 @@ static void adjust_stack_size(pm_thread_t* callee,
}
if(mmc_resolve(&callee->process->context,
- (vaddr_t) callee_isf->esp - rounded_data_size) == NULL)
+ (vaddr_t) callee_isf->esp - rounded_data_size) == (paddr_t) NULL)
{
// TODO Das könnte bis zu (pages_count - 1) Pages zu viel reservieren
increase_user_stack_size(callee, pages_count);
diff --git a/src/kernel2/src/tasks/modules.c b/src/kernel2/src/tasks/modules.c
index 080fd24..f5a839f 100644
--- a/src/kernel2/src/tasks/modules.c
+++ b/src/kernel2/src/tasks/modules.c
@@ -120,7 +120,7 @@ static void load_module(struct multiboot_module* multiboot_module)
// Modul unmappen und Speicher freigeben
vmm_kernel_unmap(image_start, image_size);
- pmm_free((vaddr_t) multiboot_module_mapped->start, NUM_PAGES(image_size));
+ pmm_free((paddr_t) multiboot_module_mapped->start, NUM_PAGES(image_size));
}
/**
@@ -143,17 +143,17 @@ void load_multiboot_modules(struct multiboot_info* multiboot_info)
multiboot_module_phys = (void*) multiboot_info->mi_mods_addr;
// Speicher für die Modulparameter
- char* mod_cmdline_page = pmm_alloc(1);
+ paddr_t mod_cmdline_page_phys = pmm_alloc(1);
void* mod_cmdline_task = mmc_automap(
- &init_process->context, mod_cmdline_page, 1,
+ &init_process->context, mod_cmdline_page_phys, 1,
MM_USER_START, MM_USER_END, MM_FLAGS_USER_DATA);
- mod_cmdline_page = vmm_kernel_automap(mod_cmdline_page, PAGE_SIZE);
+ char* mod_cmdline_page = vmm_kernel_automap(mod_cmdline_page_phys, PAGE_SIZE);
char* mod_cmdline = mod_cmdline_page;
size_t mod_cmdline_free = PAGE_SIZE;
// Speicher für die Modulliste
- void* mod_list_phys = pmm_alloc(1);
+ paddr_t mod_list_phys = pmm_alloc(1);
void* mod_list_task = mmc_automap(
&init_process->context, mod_list_phys, 1,
MM_USER_START, MM_USER_END, MM_FLAGS_USER_DATA);
--
1.7.3.4