/trunk/kernel/arch/amd64/_link.ld.in |
---|
8,7 → 8,6 |
* kernel data |
*/ |
#define __ASM__ |
#include <arch/boot/boot.h> |
#include <arch/mm/page.h> |
/trunk/kernel/arch/amd64/include/interrupt.h |
---|
69,7 → 69,7 |
#define VECTOR_DEBUG_IPI (IVT_FREEBASE + 2) |
/** This is passed to interrupt handlers */ |
struct istate { |
typedef struct { |
uint64_t rax; |
uint64_t rbx; |
uint64_t rcx; |
90,7 → 90,7 |
uint64_t cs; |
uint64_t rflags; |
uint64_t stack[]; /* Additional data on stack */ |
}; |
} istate_t; |
/** Return true if exception happened while in userspace */ |
static inline int istate_from_uspace(istate_t *istate) |
/trunk/kernel/arch/amd64/include/types.h |
---|
36,6 → 36,8 |
#define KERN_amd64_TYPES_H_ |
#define NULL 0 |
#define false 0 |
#define true 1 |
typedef signed char int8_t; |
typedef signed short int16_t; |
47,17 → 49,43 |
typedef unsigned int uint32_t; |
typedef unsigned long long uint64_t; |
typedef uint64_t size_t; |
typedef uint64_t count_t; |
typedef uint64_t index_t; |
typedef uint64_t uintptr_t; |
typedef uint64_t pfn_t; |
/* Flags of processor (return value of interrupts_disable()) */ |
typedef uint64_t ipl_t; |
typedef uint64_t unative_t; |
typedef int64_t native_t; |
typedef struct page_specifier pte_t; |
typedef uint8_t bool; |
typedef uint64_t task_id_t; |
typedef uint32_t context_id_t; |
typedef int32_t inr_t; |
typedef int32_t devno_t; |
/** Page Table Entry. */ |
typedef struct { |
unsigned present : 1; |
unsigned writeable : 1; |
unsigned uaccessible : 1; |
unsigned page_write_through : 1; |
unsigned page_cache_disable : 1; |
unsigned accessed : 1; |
unsigned dirty : 1; |
unsigned unused: 1; |
unsigned global : 1; |
unsigned soft_valid : 1; /**< Valid content even if present bit is cleared. */ |
unsigned avl : 2; |
unsigned addr_12_31 : 30; |
unsigned addr_32_51 : 21; |
unsigned no_execute : 1; |
} __attribute__ ((packed)) pte_t; |
#endif |
/** @} |
/trunk/kernel/arch/amd64/include/atomic.h |
---|
38,7 → 38,6 |
#include <arch/types.h> |
#include <arch/barrier.h> |
#include <preemption.h> |
#include <typedefs.h> |
static inline void atomic_inc(atomic_t *val) { |
#ifdef CONFIG_SMP |
/trunk/kernel/arch/amd64/include/pm.h |
---|
36,9 → 36,8 |
#define KERN_amd64_PM_H_ |
#ifndef __ASM__ |
# include <arch/types.h> |
# include <typedefs.h> |
# include <arch/context.h> |
# include <arch/types.h> |
# include <arch/context.h> |
#endif |
#define IDT_ITEMS 64 |
/trunk/kernel/arch/amd64/include/proc/task.h |
---|
35,7 → 35,6 |
#ifndef KERN_amd64_TASK_H_ |
#define KERN_amd64_TASK_H_ |
#include <typedefs.h> |
#include <arch/types.h> |
#include <adt/bitmap.h> |
/trunk/kernel/arch/amd64/include/proc/thread.h |
---|
35,8 → 35,6 |
#ifndef KERN_amd64_THREAD_H_ |
#define KERN_amd64_THREAD_H_ |
#include <arch/types.h> |
typedef struct { |
unative_t tls; |
} thread_arch_t; |
/trunk/kernel/arch/amd64/include/asm.h |
---|
35,8 → 35,6 |
#ifndef KERN_amd64_ASM_H_ |
#define KERN_amd64_ASM_H_ |
#include <arch/pm.h> |
#include <arch/types.h> |
#include <config.h> |
extern void asm_delay_loop(uint32_t t); |
/trunk/kernel/arch/amd64/include/mm/page.h |
---|
57,11 → 57,10 |
#ifdef KERNEL |
#ifndef __ASM__ |
# include <mm/page.h> |
# include <arch/types.h> |
#endif |
# include <mm/mm.h> |
# include <arch/types.h> |
# include <arch/interrupt.h> |
#ifndef __ASM__ |
static inline uintptr_t ka2pa(uintptr_t x) |
{ |
if (x > 0xffffffff80000000) |
69,12 → 68,13 |
else |
return x - 0xffff800000000000; |
} |
# define KA2PA(x) ka2pa((uintptr_t)x) |
# define PA2KA_CODE(x) (((uintptr_t) (x)) + 0xffffffff80000000) |
# define PA2KA(x) (((uintptr_t) (x)) + 0xffff800000000000) |
# define KA2PA(x) ka2pa((uintptr_t)x) |
# define PA2KA_CODE(x) (((uintptr_t) (x)) + 0xffffffff80000000) |
# define PA2KA(x) (((uintptr_t) (x)) + 0xffff800000000000) |
#else |
# define KA2PA(x) ((x) - 0xffffffff80000000) |
# define PA2KA(x) ((x) + 0xffffffff80000000) |
# define KA2PA(x) ((x) - 0xffffffff80000000) |
# define PA2KA(x) ((x) + 0xffffffff80000000) |
#endif |
#define PTL0_ENTRIES_ARCH 512 |
133,24 → 133,6 |
/** When bit on this position os 1, the page fault was caused during instruction fecth. */ |
#define PFERR_CODE_ID (1<<4) |
/** Page Table Entry. */ |
struct page_specifier { |
unsigned present : 1; |
unsigned writeable : 1; |
unsigned uaccessible : 1; |
unsigned page_write_through : 1; |
unsigned page_cache_disable : 1; |
unsigned accessed : 1; |
unsigned dirty : 1; |
unsigned unused: 1; |
unsigned global : 1; |
unsigned soft_valid : 1; /**< Valid content even if present bit is cleared. */ |
unsigned avl : 2; |
unsigned addr_12_31 : 30; |
unsigned addr_32_51 : 21; |
unsigned no_execute : 1; |
} __attribute__ ((packed)); |
static inline int get_pt_flags(pte_t *pt, index_t i) |
{ |
pte_t *p = &pt[i]; |
/trunk/kernel/arch/amd64/include/mm/as.h |
---|
44,9 → 44,6 |
#define USTACK_ADDRESS_ARCH (USER_ADDRESS_SPACE_END_ARCH-(PAGE_SIZE-1)) |
typedef struct { |
} as_arch_t; |
#define as_constructor_arch(as, flags) (as != as) |
#define as_destructor_arch(as) (as != as) |
#define as_create_arch(as, flags) (as != as) |
54,6 → 51,11 |
#define as_deinstall_arch(as) |
#define as_invalidate_translation_cache(as, page, cnt) |
typedef struct { |
} as_arch_t; |
#include <genarch/mm/as_pt.h> |
extern void as_arch_init(void); |
#endif |
/trunk/kernel/arch/amd64/include/cpu.h |
---|
54,7 → 54,6 |
#ifndef __ASM__ |
#include <typedefs.h> |
#include <arch/pm.h> |
typedef struct { |
/trunk/kernel/arch/amd64/src/fpu_context.c |
---|
34,8 → 34,6 |
*/ |
#include <fpu_context.h> |
#include <arch.h> |
#include <cpu.h> |
/** Save FPU (mmx, sse) context using fxsave instruction */ |
void fpu_context_save(fpu_context_t *fctx) |
/trunk/kernel/arch/amd64/src/cpu/cpu.c |
---|
32,6 → 32,7 |
/** @file |
*/ |
#include <cpu.h> |
#include <arch/cpu.h> |
#include <arch/cpuid.h> |
#include <arch/pm.h> |
39,7 → 40,6 |
#include <arch.h> |
#include <arch/types.h> |
#include <print.h> |
#include <typedefs.h> |
#include <fpu_context.h> |
/* |
56,7 → 56,7 |
enum vendor { |
VendorUnknown=0, |
VendorUnknown = 0, |
VendorAMD, |
VendorIntel |
}; |
/trunk/kernel/arch/amd64/src/pm.c |
---|
34,18 → 34,11 |
*/ |
#include <arch/pm.h> |
#include <arch/mm/page.h> |
#include <arch/types.h> |
#include <arch/interrupt.h> |
#include <arch/asm.h> |
#include <interrupt.h> |
#include <mm/as.h> |
#include <config.h> |
#include <mm/frame.h> |
#include <memstr.h> |
#include <mm/slab.h> |
#include <debug.h> |
/* |
* There is no segmentation in long mode so we set up flat mode. In this |
/trunk/kernel/arch/amd64/src/ddi/ddi.c |
---|
36,7 → 36,6 |
#include <arch/ddi/ddi.h> |
#include <proc/task.h> |
#include <arch/types.h> |
#include <typedefs.h> |
#include <adt/bitmap.h> |
#include <mm/slab.h> |
#include <arch/pm.h> |
/trunk/kernel/arch/amd64/src/mm/memory_init.c |
---|
38,7 → 38,7 |
#include <print.h> |
uint8_t e820counter = 0xff; |
struct e820memmap_ e820table[MEMMAP_E820_MAX_RECORDS]; |
e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS]; |
uint32_t e801memorysize; |
size_t get_memory_size(void) |