[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH 04/11] typen: veraltete typen qword, ... byte ersetzt
Signed-off-by: Andreas Freimuth <m.nemo@xxxxxxx>
--HG--
rename : src/include/arch/i386/types.h => src/include/types.h
extra : rebase_source : 3bd8c54b6e6732160b500255a3d59c51fd150a74
---
src/include/arch/amd64/types.h | 61 -------------------
src/include/arch/i386/types.h | 59 -------------------
src/include/types.h | 59 +++++++++++++++++++
src/kernel2/include/arch/amd64/cpu.h | 51 ++++++++--------
src/kernel2/include/debug.h | 4 +-
src/kernel2/src/arch/amd64/cpu.c | 88 ++++++++++++++--------------
src/kernel2/src/arch/amd64/debug.c | 2 +-
src/kernel2/src/arch/amd64/im/im.c | 32 +++++-----
src/kernel2/src/arch/amd64/loader/loader.c | 3 +-
src/kernel2/src/arch/amd64/mm/mm_context.c | 22 ++++----
src/kernel2/src/arch/amd64/mm/mm_virt.c | 8 +-
11 files changed, 164 insertions(+), 225 deletions(-)
delete mode 100644 src/include/arch/amd64/types.h
delete mode 100644 src/include/arch/i386/types.h
create mode 100644 src/include/types.h
diff --git a/src/include/arch/amd64/types.h b/src/include/arch/amd64/types.h
deleted file mode 100644
index e4e4ecc..0000000
--- a/src/include/arch/amd64/types.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2006 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Kevin Wolf.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TYPES_H
-#define TYPES_H
-
-#define NULL (void*) 0
-
-#ifndef __cplusplus
-typedef enum { FALSE = 0, TRUE } bool;
-#endif
-
-typedef unsigned char byte;
-typedef unsigned short word;
-typedef unsigned int dword;
-typedef unsigned long long qword;
-
-typedef signed char sbyte;
-typedef signed short sword;
-typedef signed int sdword;
-typedef signed long long sqword;
-
-typedef __SIZE_TYPE__ size_t;
-typedef __SIZE_TYPE__ ssize_t;
-
-typedef void * paddr_t;
-typedef void * vaddr_t;
-
-typedef dword pid_t;
-typedef dword uid_t;
-typedef dword thread_id_t;
-
-typedef qword timestamp_t;
-
-typedef qword syscall_id_t;
-#endif
diff --git a/src/include/arch/i386/types.h b/src/include/arch/i386/types.h
deleted file mode 100644
index c6a43d3..0000000
--- a/src/include/arch/i386/types.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2006 The tyndur Project. All rights reserved.
- *
- * This code is derived from software contributed to the tyndur Project
- * by Kevin Wolf.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _TYPES_H_
-#define _TYPES_H_
-#include <stddef.h>
-#include <stdint.h>
-
-typedef signed int ssize_t;
-
-typedef void * paddr_t;
-typedef void * vaddr_t;
-
-typedef unsigned int pid_t;
-typedef unsigned int uid_t;
-typedef unsigned int gid_t;
-
-#endif
-
-// FIXME Um pid_t aus sys/types holen zu koennen
-#ifndef _NO_LOST_TYPES
-
-// Schutz vor mehrfachen Deklarationen
-#ifndef _LOST_TYPES_
-#define _LOST_TYPES_
-
-
-
-typedef uint64_t timestamp_t;
-
-typedef uint32_t syscall_id_t;
-#endif // ndef _LOST_TYPES_
-#endif // ndef _NO_LOST_TYPES
-
diff --git a/src/include/types.h b/src/include/types.h
new file mode 100644
index 0000000..1ae793f
--- /dev/null
+++ b/src/include/types.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2006 The tyndur Project. All rights reserved.
+ *
+ * This code is derived from software contributed to the tyndur Project
+ * by Kevin Wolf.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _TYPES_H_
+#define _TYPES_H_
+#include <stddef.h>
+#include <stdint.h>
+
+typedef signed long ssize_t;
+
+typedef void * paddr_t;
+typedef void * vaddr_t;
+
+typedef unsigned int pid_t;
+typedef unsigned int uid_t;
+typedef unsigned int gid_t;
+
+#endif
+
+// FIXME Um pid_t aus sys/types holen zu koennen
+#ifndef _NO_LOST_TYPES
+
+// Schutz vor mehrfachen Deklarationen
+#ifndef _LOST_TYPES_
+#define _LOST_TYPES_
+
+
+
+typedef uint64_t timestamp_t;
+
+typedef uint32_t syscall_id_t;
+#endif // ndef _LOST_TYPES_
+#endif // ndef _NO_LOST_TYPES
+
diff --git a/src/kernel2/include/arch/amd64/cpu.h b/src/kernel2/include/arch/amd64/cpu.h
index 8de9552..bd60f26 100644
--- a/src/kernel2/include/arch/amd64/cpu.h
+++ b/src/kernel2/include/arch/amd64/cpu.h
@@ -35,42 +35,41 @@
#ifndef _CPU_H_
#define _CPU_H_
+#include <stdint.h>
#include <types.h>
#include "mm.h"
-typedef byte cpu_id_t;
+typedef uint8_t cpu_id_t;
typedef struct {
cpu_id_t id;
- byte apic_id;
+ uint8_t apic_id;
bool bootstrap;
} cpu_t;
typedef struct {
- qword rbx;
- qword rcx;
- qword rdx;
- qword rsi;
- qword rdi;
- qword rbp;
- qword r[8];
-
- qword ds;
- qword es;
- /*qword fs;
- qword gs;*/
+ uint64_t rbx;
+ uint64_t rcx;
+ uint64_t rdx;
+ uint64_t rsi;
+ uint64_t rdi;
+ uint64_t rbp;
+ uint64_t r[8];
- qword rax;
+ uint64_t ds;
+ uint64_t es;
- qword interrupt_number;
- qword error_code;
- qword rip;
- qword cs;
- qword rflags;
- qword rsp;
- qword ss;
- //qword r[8];
- qword fs, gs;
+ uint64_t rax;
+
+ uint64_t interrupt_number;
+ uint64_t error_code;
+ uint64_t rip;
+ uint64_t cs;
+ uint64_t rflags;
+ uint64_t rsp;
+ uint64_t ss;
+
+ uint64_t fs, gs;
} __attribute__((packed)) interrupt_stack_frame_t;
typedef interrupt_stack_frame_t machine_state_t;
@@ -84,8 +83,8 @@ cpu_t* cpu_get(cpu_id_t id);
cpu_t* cpu_get_current();
void cpu_dump(machine_state_t* machine_state);
-void cpu_write_msr(dword msr, qword value);
-qword cpu_read_msr(dword reg);
+void cpu_write_msr(uint32_t msr, uint64_t value);
+uint64_t cpu_read_msr(uint32_t reg);
mmc_context_t cpu_get_context();
void cpu_set_context(mmc_context_t context);
diff --git a/src/kernel2/include/debug.h b/src/kernel2/include/debug.h
index 99eafca..0b9ba66 100644
--- a/src/kernel2/include/debug.h
+++ b/src/kernel2/include/debug.h
@@ -57,8 +57,8 @@ void debug_print(uint32_t flag, const char* message);
/*
* Gibt einen Stack Backtrace aus, beginnend an den �benen Werten
- * f� und eip
+ * f�und ip
*/
-void stack_backtrace(uint32_t start_ebp, uint32_t start_eip);
+void stack_backtrace(uintptr_t start_bp, uintptr_t start_ip);
#endif
diff --git a/src/kernel2/src/arch/amd64/cpu.c b/src/kernel2/src/arch/amd64/cpu.c
index 9e3c18e..b9f2b7d 100644
--- a/src/kernel2/src/arch/amd64/cpu.c
+++ b/src/kernel2/src/arch/amd64/cpu.c
@@ -77,7 +77,7 @@ cpu_t* cpu_get(cpu_id_t id)
*/
cpu_t* cpu_get_current()
{
- byte apic_id = apic_read(0x20) >> 24;
+ uint8_t apic_id = apic_read(0x20) >> 24;
cpu_id_t i;
for (i = 0; i < cpu_count; i++) {
@@ -95,10 +95,10 @@ cpu_t* cpu_get_current()
* @param msr Adresse des Registers
* @param value Neuer Wert
*/
-void cpu_write_msr(dword msr, qword value)
+void cpu_write_msr(uint32_t msr, uint64_t value)
{
- dword low = value & 0xFFFFFFFF;
- dword high = (value >> 32) & 0xFFFFFFFF;
+ uint32_t low = value & 0xFFFFFFFF;
+ uint32_t high = (value >> 32) & 0xFFFFFFFF;
asm ("wrmsr" : : "a" (low), "d" (high),"c" (msr));
}
@@ -109,11 +109,11 @@ void cpu_write_msr(dword msr, qword value)
*
* @return Wert der im MSR gespeichert ist
*/
-qword cpu_read_msr(dword msr)
+uint64_t cpu_read_msr(uint32_t msr)
{
- dword low, high;
+ uint32_t low, high;
asm ("rdmsr" : "=a" (low), "=d" (high) : "c" (msr));
- return low | ((qword)high << 32);
+ return low | ((uint64_t)high << 32);
}
/**
@@ -124,47 +124,47 @@ qword cpu_read_msr(dword msr)
void cpu_dump(machine_state_t* machine_state)
{
kprintf("RAX=0x%08x%08x RBX=0x%08x%08x RCX=0x%08x%08x\n",
- (dword) (machine_state->rax >> 32),
- (dword) (machine_state->rax & 0xFFFFFFFF),
- (dword) (machine_state->rbx >> 32),
- (dword) (machine_state->rbx & 0xFFFFFFFF),
- (dword) (machine_state->rcx >> 32),
- (dword) (machine_state->rcx & 0xFFFFFFFF));
+ (uint32_t) (machine_state->rax >> 32),
+ (uint32_t) (machine_state->rax & 0xFFFFFFFF),
+ (uint32_t) (machine_state->rbx >> 32),
+ (uint32_t) (machine_state->rbx & 0xFFFFFFFF),
+ (uint32_t) (machine_state->rcx >> 32),
+ (uint32_t) (machine_state->rcx & 0xFFFFFFFF));
kprintf("RDX=0x%08x%08x RSI=0x%08x%08x RDI=0x%08x%08x\n",
- (dword) (machine_state->rdx >> 32),
- (dword) (machine_state->rdx & 0xFFFFFFFF),
- (dword) (machine_state->rsi >> 32),
- (dword) (machine_state->rsi & 0xFFFFFFFF),
- (dword) (machine_state->rdi >> 32),
- (dword) (machine_state->rdi & 0xFFFFFFFF));
+ (uint32_t) (machine_state->rdx >> 32),
+ (uint32_t) (machine_state->rdx & 0xFFFFFFFF),
+ (uint32_t) (machine_state->rsi >> 32),
+ (uint32_t) (machine_state->rsi & 0xFFFFFFFF),
+ (uint32_t) (machine_state->rdi >> 32),
+ (uint32_t) (machine_state->rdi & 0xFFFFFFFF));
kprintf("RSP=0x%08x%08x RBP=0x%08x%08x R08=0x%08x%08x\n",
- (dword) (machine_state->rsp >> 32),
- (dword) (machine_state->rsp & 0xFFFFFFFF),
- (dword) (machine_state->rbp >> 32),
- (dword) (machine_state->rbp & 0xFFFFFFFF),
- (dword) (machine_state->r[0] >> 32),
- (dword) (machine_state->r[0] & 0xFFFFFFFF));
+ (uint32_t) (machine_state->rsp >> 32),
+ (uint32_t) (machine_state->rsp & 0xFFFFFFFF),
+ (uint32_t) (machine_state->rbp >> 32),
+ (uint32_t) (machine_state->rbp & 0xFFFFFFFF),
+ (uint32_t) (machine_state->r[0] >> 32),
+ (uint32_t) (machine_state->r[0] & 0xFFFFFFFF));
kprintf("R09=0x%08x%08x R10=0x%08x%08x R11=0x%08x%08x\n",
- (dword) (machine_state->r[1] >> 32),
- (dword) (machine_state->r[1] & 0xFFFFFFFF),
- (dword) (machine_state->r[2] >> 32),
- (dword) (machine_state->r[2] & 0xFFFFFFFF),
- (dword) (machine_state->r[3] >> 32),
- (dword) (machine_state->r[3] & 0xFFFFFFFF));
+ (uint32_t) (machine_state->r[1] >> 32),
+ (uint32_t) (machine_state->r[1] & 0xFFFFFFFF),
+ (uint32_t) (machine_state->r[2] >> 32),
+ (uint32_t) (machine_state->r[2] & 0xFFFFFFFF),
+ (uint32_t) (machine_state->r[3] >> 32),
+ (uint32_t) (machine_state->r[3] & 0xFFFFFFFF));
kprintf("R12=0x%08x%08x R13=0x%08x%08x R14=0x%08x%08x\n",
- (dword) (machine_state->r[4] >> 32),
- (dword) (machine_state->r[4] & 0xFFFFFFFF),
- (dword) (machine_state->r[5] >> 32),
- (dword) (machine_state->r[5] & 0xFFFFFFFF),
- (dword) (machine_state->r[6] >> 32),
- (dword) (machine_state->r[6] & 0xFFFFFFFF));
+ (uint32_t) (machine_state->r[4] >> 32),
+ (uint32_t) (machine_state->r[4] & 0xFFFFFFFF),
+ (uint32_t) (machine_state->r[5] >> 32),
+ (uint32_t) (machine_state->r[5] & 0xFFFFFFFF),
+ (uint32_t) (machine_state->r[6] >> 32),
+ (uint32_t) (machine_state->r[6] & 0xFFFFFFFF));
kprintf("R15=0x%08x%08x RIP=0x%08x%08x RFL=0x%08x%08x\n",
- (dword) (machine_state->r[7] >> 32),
- (dword) (machine_state->r[7] & 0xFFFFFFFF),
- (dword) (machine_state->rip >> 32),
- (dword) (machine_state->rip & 0xFFFFFFFF),
- (dword) (machine_state->rflags >> 32),
- (dword) (machine_state->rflags & 0xFFFFFFFF));
+ (uint32_t) (machine_state->r[7] >> 32),
+ (uint32_t) (machine_state->r[7] & 0xFFFFFFFF),
+ (uint32_t) (machine_state->rip >> 32),
+ (uint32_t) (machine_state->rip & 0xFFFFFFFF),
+ (uint32_t) (machine_state->rflags >> 32),
+ (uint32_t) (machine_state->rflags & 0xFFFFFFFF));
kprintf("CS=0x%04x DS=0x%04x ES=0x%04x FS=0x%04x GS=0x%04x "
"SS=0x%04x\n",
@@ -172,7 +172,7 @@ void cpu_dump(machine_state_t* machine_state)
machine_state->es & 0xFFFF, machine_state->fs & 0xFFFF,
machine_state->gs & 0xFFFF, machine_state->ss & 0xFFFF);
- qword cr[5];
+ uint64_t cr[5];
asm("movq %%cr0, %0" : "=A" (cr[0]));
asm("movq %%cr2, %0" : "=A" (cr[2]));
asm("movq %%cr3, %0" : "=A" (cr[3]));
diff --git a/src/kernel2/src/arch/amd64/debug.c b/src/kernel2/src/arch/amd64/debug.c
index aa5cddb..589d9dc 100644
--- a/src/kernel2/src/arch/amd64/debug.c
+++ b/src/kernel2/src/arch/amd64/debug.c
@@ -42,7 +42,7 @@
#include "multiboot.h"
#include "debug.h"
-void stack_backtrace(qword start_rbp, qword start_rip)
+void stack_backtrace(uintptr_t start_rbp, uintptr_t start_rip)
{
struct stack_frame
{
diff --git a/src/kernel2/src/arch/amd64/im/im.c b/src/kernel2/src/arch/amd64/im/im.c
index da1870d..c0eeb74 100644
--- a/src/kernel2/src/arch/amd64/im/im.c
+++ b/src/kernel2/src/arch/amd64/im/im.c
@@ -47,29 +47,29 @@
typedef struct {
/// Die untersten 16 Bits der Handler-Adresse
- word offset_low;
+ uint16_t offset_low;
/// Code-Segment-Selektor
- word segment;
+ uint16_t segment;
/// ID des Stack-Table-Eintrages
- byte interrupt_stack_table : 3;
+ uint8_t interrupt_stack_table : 3;
/// Reserviert
- byte : 5;
+ uint8_t : 5;
/// Typ des Gates
- byte type : 4;
+ uint8_t type : 4;
/// Reserviert
- byte : 1;
+ uint8_t : 1;
/// Noetiges Privileg-Level um den Handler aufrufen zu duerfen
- byte privilege_level : 2;
+ uint8_t privilege_level : 2;
/// Bestimmt, ob das Gate praesent
bool present : 1;
/// Die naechsten paar Bits der Adresse
- word offset_mid;
- dword offset_high;
+ uint16_t offset_mid;
+ uint32_t offset_high;
/// Reserviert
- dword : 32;
+ uint32_t : 32;
} __attribute__((packed)) idt_gate_t;
@@ -77,7 +77,7 @@ typedef struct {
idt_gate_t idt[IDT_GATE_COUNT];
bool use_apic;
-static void idt_set_gate(size_t interrupt, vaddr_t handler, byte privilege_level);
+static void idt_set_gate(size_t interrupt, vaddr_t handler, uint8_t privilege_level);
// Die ASM-Stubs
extern void im_int_stub_0();
@@ -609,11 +609,11 @@ void im_enable()
{
// Register zum laden der IDT vorbereiten
struct {
- word size;
- qword base;
+ uint16_t size;
+ uint64_t base;
} __attribute__((packed)) idt_ptr = {
.size = IDT_GATE_COUNT * sizeof(idt_gate_t) - 1,
- .base = (qword)idt,
+ .base = (uint64_t)idt,
};
asm("lidt %0" : : "m" (idt_ptr));
@@ -627,7 +627,7 @@ void im_enable()
* @param privilege_level Bestimmt ob der Interrup fuer den Kernel- (0) oder
* fuer den User-Ring (3) bestimmt ist.
*/
-static void idt_set_gate(size_t interrupt, vaddr_t handler, byte privilege_level)
+static void idt_set_gate(size_t interrupt, vaddr_t handler, uint8_t privilege_level)
{
// Handler-Adresse
uintptr_t uint_handler = (uintptr_t) handler;
@@ -647,7 +647,7 @@ static void idt_set_gate(size_t interrupt, vaddr_t handler, byte privilege_level
*
* @param interrupt Interruptnummer
*/
-void im_end_of_interrupt(byte interrupt)
+void im_end_of_interrupt(uint8_t interrupt)
{
// Nur mit dem traditionellen PIC
if (use_apic == FALSE) {
diff --git a/src/kernel2/src/arch/amd64/loader/loader.c b/src/kernel2/src/arch/amd64/loader/loader.c
index 39976b8..fff1940 100644
--- a/src/kernel2/src/arch/amd64/loader/loader.c
+++ b/src/kernel2/src/arch/amd64/loader/loader.c
@@ -32,6 +32,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <stdint.h>
#include <elf64.h>
#include <multiboot.h>
#include <string.h>
@@ -43,7 +44,7 @@ void print(const char* str);
/**
* Hauptfunktion des Loaders.
*/
-void loader(qword multiboot_info_addr)
+void loader(uint64_t multiboot_info_addr)
{
extern void* _binary_kernel_start;
Elf64_Ehdr* elf_header = (Elf64_Ehdr*) (&_binary_kernel_start);
diff --git a/src/kernel2/src/arch/amd64/mm/mm_context.c b/src/kernel2/src/arch/amd64/mm/mm_context.c
index 751e4de..b6d5274 100644
--- a/src/kernel2/src/arch/amd64/mm/mm_context.c
+++ b/src/kernel2/src/arch/amd64/mm/mm_context.c
@@ -145,11 +145,11 @@ static mmc_pdpt_entry_t* pdpt_get(mmc_pm_entry_t* pm,
// Die PDPT wird sauber mit Null initialisiert => Present-Bit
// geloescht.
memset(pdpt, 0, PAGE_SIZE);
-
+
// Die pdpt wird in der Pagemap eingetragen
- pm[index] = (qword) phys | PAGE_FLAGS_PRESENT |
+ pm[index] = (mmc_pm_entry_t) phys | PAGE_FLAGS_PRESENT |
PAGE_FLAGS_WRITABLE | PAGE_FLAGS_USER;
-
+
return pdpt;
} else {
// PDPT Nicht voranden und soll nicht erstellt werden
@@ -185,7 +185,7 @@ static mmc_pd_entry_t* pd_get(mmc_pdpt_entry_t* pdpt, size_t index,
memset(pd, 0, PAGE_SIZE);
// Das PD wird in der Pagemap eingetragen
- pdpt[index] = (qword) phys | PAGE_FLAGS_PRESENT |
+ pdpt[index] = (mmc_pdpt_entry_t) phys | PAGE_FLAGS_PRESENT |
PAGE_FLAGS_WRITABLE | PAGE_FLAGS_USER;
return pd;
@@ -225,7 +225,7 @@ static mmc_pt_entry_t* pt_get(mmc_pd_entry_t* pd, size_t index, bool create,
memset(pt, 0, PAGE_SIZE);
// Die PT wird in der Pagemap eingetragen
- pd[index] = (qword) phys | PAGE_FLAGS_PRESENT |
+ pd[index] = (mmc_pd_entry_t) phys | PAGE_FLAGS_PRESENT |
PAGE_FLAGS_WRITABLE | PAGE_FLAGS_USER;
return pt;
@@ -347,7 +347,7 @@ static bool map_page
//kprintf("map 0x%16x => 0x%16x\n", vaddr, paddr);
bool big_page = FALSE;
bool user_page = FALSE;
- qword internal_flags = flags;
+ uint64_t internal_flags = flags;
if ((flags & PAGE_FLAGS_BIG) != 0) {
big_page = TRUE;
@@ -398,14 +398,14 @@ static bool map_page
size_t index = PAGE_DIRECTORY_INDEX((uintptr_t) vaddr);
if (pd == NULL) {
- panic("Doppelbelegung in Page Map. (0x%x)", (qword) vaddr);
+ panic("Doppelbelegung in Page Map. (0x%lx)", (uintptr_t) vaddr);
}
if ((pd[index] & 1) == 1) {
- panic("Doppelbelegung im Page Directory. (0x%x)", (qword) vaddr);
+ panic("Doppelbelegung im Page Directory. (0x%lx)", (uintptr_t) vaddr);
}
- pd[index] = (qword) paddr | internal_flags;
+ pd[index] = (mmc_pd_entry_t) paddr | internal_flags;
pd_free(pd);
} else {
@@ -416,7 +416,7 @@ static bool map_page
// Wenn sie nicht angefordert werden konnte, ist der eintrag im PD
// durch eine Grosse Page belegt.
if (pt == NULL) {
- panic("Doppelbelegung im Page Directory. (0x%x)", (qword) vaddr);
+ panic("Doppelbelegung im Page Directory. (0x%lx)", (uintptr_t) vaddr);
return FALSE;
}
@@ -431,7 +431,7 @@ static bool map_page
}
// Wenn alles gut gelaufen ist, wirds jetzt ernst
- pt[index] = (qword) paddr | internal_flags;
+ pt[index] = (mmc_pt_entry_t) paddr | internal_flags;
pt_free(pt);
}
diff --git a/src/kernel2/src/arch/amd64/mm/mm_virt.c b/src/kernel2/src/arch/amd64/mm/mm_virt.c
index 9dd4456..544b8cb 100644
--- a/src/kernel2/src/arch/amd64/mm/mm_virt.c
+++ b/src/kernel2/src/arch/amd64/mm/mm_virt.c
@@ -56,7 +56,7 @@ void vmm_init(mmc_context_t context)
{
// No execute - Erweiterung aktivieren
// Mit cpuid wird geprueft, ob sie ueberhaupt verfügbar ist
- dword features = 0;
+ uint32_t features = 0;
asm("movl $0x80000001, %%eax;"
"cpuid;"
: "=d" (features) : : "eax", "ebx", "ecx");
@@ -69,7 +69,7 @@ void vmm_init(mmc_context_t context)
}
// Den Kernel mappen
- mmc_map(context, kernel_start, kernel_phys_start, MM_FLAGS_KERNEL_CODE,
+ mmc_map(context, kernel_start, (paddr_t) kernel_phys_start, MM_FLAGS_KERNEL_CODE,
NUM_PAGES((uintptr_t) kernel_end - (uintptr_t) kernel_start));
// Videospeicher mappen
@@ -83,7 +83,7 @@ void vmm_init(mmc_context_t context)
// Bitmap mit dem physischen Speicher mappen.
void* phys_mmap = pmm_get_bitmap_start();
size_t phys_mmap_size = pmm_get_bitmap_size();
- phys_mmap = vmm_kernel_automap(phys_mmap, NUM_PAGES(phys_mmap_size));
+ phys_mmap = vmm_kernel_automap((paddr_t) phys_mmap, NUM_PAGES(phys_mmap_size));
pmm_set_bitmap_start(phys_mmap);
// Auf dem Bootstrap-Prozessor wird das ganze schon eingerichtet. Diese
@@ -139,7 +139,7 @@ void vmm_kernel_unmap(vaddr_t start, size_t size)
/**
* Fuer malloc()
*/
-void* mem_allocate(dword size, dword flags)
+void* mem_allocate(size_t size, int flags)
{
return vmm_kernel_automap(pmm_alloc(NUM_PAGES(size)), size);
}
--
1.7.3.4