Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2087 → Rev 2089

/trunk/kernel/arch/sparc64/_link.ld.in
6,7 → 6,6
*
*/
 
#define __LINKER__
#include <arch/boot/boot.h>
 
ENTRY(kernel_image_start)
/trunk/kernel/arch/sparc64/include/interrupt.h
36,7 → 36,6
#ifndef KERN_sparc64_INTERRUPT_H_
#define KERN_sparc64_INTERRUPT_H_
 
#include <typedefs.h>
#include <arch/types.h>
#include <arch/regdef.h>
 
50,11 → 49,11
IPI_TLB_SHOOTDOWN = VECTOR_TLB_SHOOTDOWN_IPI
};
 
struct istate {
typedef struct {
uint64_t tnpc;
uint64_t tpc;
uint64_t tstate;
};
} istate_t;
 
static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr)
{
71,9 → 70,6
return istate->tpc;
}
 
 
extern void interrupt_register(int n, const char *name, iroutine f);
 
#endif
 
/** @}
/trunk/kernel/arch/sparc64/include/types.h
35,7 → 35,9
#ifndef KERN_sparc64_TYPES_H_
#define KERN_sparc64_TYPES_H_
 
#define NULL 0
#define NULL 0
#define false 0
#define true 1
 
typedef signed char int8_t;
typedef signed short int16_t;
47,6 → 49,10
typedef unsigned int uint32_t;
typedef unsigned 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;
 
55,8 → 61,12
typedef uint64_t unative_t;
typedef int64_t native_t;
 
typedef struct pte 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;
typedef uint8_t asi_t;
 
#endif
/trunk/kernel/arch/sparc64/include/syscall.h
35,8 → 35,8
#ifndef KERN_sparc64_SYSCALL_H_
#define KERN_sparc64_SYSCALL_H_
 
#include <typedefs.h>
#include <arch/types.h>
#include <arch/interrupt.h>
 
extern unative_t syscall(int n, istate_t *istate, unative_t a1, unative_t a2, unative_t a3, unative_t a4);
 
/trunk/kernel/arch/sparc64/include/atomic.h
37,7 → 37,6
 
#include <arch/barrier.h>
#include <arch/types.h>
#include <typedefs.h>
 
/** Atomic add operation.
*
/trunk/kernel/arch/sparc64/include/boot/boot.h
43,7 → 43,6
 
#include <config.h>
#include <arch/types.h>
#include <typedefs.h>
#include <genarch/ofw/ofw_tree.h>
 
#define TASKMAP_MAX_RECORDS 32
/trunk/kernel/arch/sparc64/include/asm.h
35,12 → 35,11
#ifndef KERN_sparc64_ASM_H_
#define KERN_sparc64_ASM_H_
 
#include <arch.h>
#include <typedefs.h>
#include <arch/arch.h>
#include <arch/types.h>
#include <align.h>
#include <arch/register.h>
#include <config.h>
#include <time/clock.h>
#include <arch/stack.h>
 
/** Read Processor State register.
/trunk/kernel/arch/sparc64/include/trap/interrupt.h
105,6 → 105,9
#endif /* __ASM__ */
 
#ifndef __ASM__
 
#include <arch/interrupt.h>
 
extern void interrupt(int n, istate_t *istate);
#endif /* !def __ASM__ */
 
/trunk/kernel/arch/sparc64/include/trap/exception.h
58,7 → 58,7
 
#ifndef __ASM__
 
#include <typedefs.h>
#include <arch/interrupt.h>
 
extern void dump_istate(istate_t *istate);
 
/trunk/kernel/arch/sparc64/include/sparc64.h
0,0 → 1,45
/*
* Copyright (c) 2005 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - 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.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
 
/** @addtogroup sparc64
* @{
*/
/** @file
*/
 
#ifndef KERN_sparc64_SPARC64_H_
#define KERN_sparc64_SPARC64_H_
 
#include <interrupt.h>
 
extern void interrupt_register(int n, const char *name, iroutine f);
 
#endif
 
/** @}
*/
/trunk/kernel/arch/sparc64/include/mm/memory_init.h
35,7 → 35,7
#ifndef KERN_sparc64_MEMORY_INIT_H_
#define KERN_sparc64_MEMORY_INIT_H_
 
#include <typedefs.h>
#include <arch/types.h>
 
extern size_t get_memory_size(void);
 
/trunk/kernel/arch/sparc64/include/mm/page.h
46,9 → 46,9
 
#ifndef __ASM__
 
#include <mm/page.h>
#include <arch/types.h>
#include <genarch/mm/page_ht.h>
//#include <arch/types.h>
//#include <genarch/mm/page_ht.h>
#include <arch/interrupt.h>
 
extern uintptr_t physmem_base;
 
55,16 → 55,14
#define KA2PA(x) (((uintptr_t) (x)) + physmem_base)
#define PA2KA(x) (((uintptr_t) (x)) - physmem_base)
 
union page_address {
typedef union {
uintptr_t address;
struct {
uint64_t vpn : 51; /**< Virtual Page Number. */
unsigned offset : 13; /**< Offset. */
} __attribute__ ((packed));
};
} page_address_t;
 
typedef union page_address page_address_t;
 
extern void page_arch_init(void);
 
#endif /* !def __ASM__ */
/trunk/kernel/arch/sparc64/include/mm/mmu.h
79,10 → 79,9
#include <arch/asm.h>
#include <arch/barrier.h>
#include <arch/types.h>
#include <typedefs.h>
 
/** LSU Control Register. */
union lsu_cr_reg {
typedef union {
uint64_t value;
struct {
unsigned : 23;
100,8 → 99,7
unsigned ic : 1; /**< I-Cache enable. */
} __attribute__ ((packed));
};
typedef union lsu_cr_reg lsu_cr_reg_t;
} lsu_cr_reg_t;
 
#endif /* !def __ASM__ */
 
/trunk/kernel/arch/sparc64/include/mm/tlb.h
76,7 → 76,6
#include <arch/asm.h>
#include <arch/barrier.h>
#include <arch/types.h>
#include <typedefs.h>
 
union tlb_context_reg {
uint64_t v;
/trunk/kernel/arch/sparc64/include/mm/as.h
35,9 → 35,7
#ifndef KERN_sparc64_AS_H_
#define KERN_sparc64_AS_H_
 
#ifdef CONFIG_TSB
#include <arch/mm/tsb.h>
#endif
#include <arch/mm/tte.h>
 
#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH 1
 
46,16 → 44,44
#define USER_ADDRESS_SPACE_START_ARCH (unsigned long) 0x0000000000000000
#define USER_ADDRESS_SPACE_END_ARCH (unsigned long) 0xffffffffffffffff
 
#define USTACK_ADDRESS_ARCH (0xffffffffffffffffULL-(PAGE_SIZE-1))
#define USTACK_ADDRESS_ARCH (0xffffffffffffffffULL - (PAGE_SIZE - 1))
 
#ifdef CONFIG_TSB
 
/** TSB Tag Target register. */
typedef union tsb_tag_target {
uint64_t value;
struct {
unsigned invalid : 1; /**< Invalidated by software. */
unsigned : 2;
unsigned context : 13; /**< Software ASID. */
unsigned : 6;
uint64_t va_tag : 42; /**< Virtual address bits <63:22>. */
} __attribute__ ((packed));
} tsb_tag_target_t;
 
/** TSB entry. */
typedef struct tsb_entry {
tsb_tag_target_t tag;
tte_data_t data;
} __attribute__ ((packed)) tsb_entry_t;
 
typedef struct {
#ifdef CONFIG_TSB
tsb_entry_t *itsb;
tsb_entry_t *dtsb;
#endif /* CONFIG_TSB */
} as_arch_t;
 
#else
 
typedef struct {
} as_arch_t;
 
#endif /* CONFIG_TSB */
 
#include <genarch/mm/as_ht.h>
 
#ifdef CONFIG_TSB
# include <arch/mm/tsb.h>
# define as_invalidate_translation_cache(as, page, cnt) tsb_invalidate(as, page, cnt)
#else
# define as_invalidate_translation_cache(as, page, cnt)
/trunk/kernel/arch/sparc64/include/mm/tsb.h
54,30 → 54,10
#include <arch/mm/tte.h>
#include <arch/mm/mmu.h>
#include <arch/types.h>
#include <typedefs.h>
#include <mm/as.h>
 
/** TSB Tag Target register. */
union tsb_tag_target {
uint64_t value;
struct {
unsigned invalid : 1; /**< Invalidated by software. */
unsigned : 2;
unsigned context : 13; /**< Software ASID. */
unsigned : 6;
uint64_t va_tag : 42; /**< Virtual address bits <63:22>. */
} __attribute__ ((packed));
};
typedef union tsb_tag_target tsb_tag_target_t;
 
/** TSB entry. */
struct tsb_entry {
tsb_tag_target_t tag;
tte_data_t data;
} __attribute__ ((packed));
typedef struct tsb_entry tsb_entry_t;
 
/** TSB Base register. */
union tsb_base_reg {
typedef union tsb_base_reg {
uint64_t value;
struct {
uint64_t base : 51; /**< TSB base address, bits 63:13. */
90,8 → 70,7
unsigned size : 3; /**< TSB size. Number of entries is
* 512 * 2^size. */
} __attribute__ ((packed));
};
typedef union tsb_base_reg tsb_base_reg_t;
} tsb_base_reg_t;
 
/** Read ITSB Base register.
*
/trunk/kernel/arch/sparc64/include/cpu.h
37,6 → 37,7
 
#include <arch/types.h>
#include <arch/register.h>
#include <arch/asm.h>
 
#define MANUF_FUJITSU 0x04
#define MANUF_ULTRASPARC 0x17 /**< UltraSPARC I, UltraSPARC II */
/trunk/kernel/arch/sparc64/include/drivers/z8530.h
36,7 → 36,6
#define KERN_sparc64_Z8530_H_
 
#include <arch/types.h>
#include <typedefs.h>
#include <arch/drivers/kbd.h>
 
#define Z8530_CHAN_A 4
/trunk/kernel/arch/sparc64/include/drivers/tick.h
35,7 → 35,7
#ifndef KERN_sparc64_TICK_H_
#define KERN_sparc64_TICK_H_
 
#include <typedefs.h>
#include <arch/interrupt.h>
 
extern void tick_init(void);
extern void tick_interrupt(int n, istate_t *istate);
/trunk/kernel/arch/sparc64/src/smp/smp.c
42,7 → 42,6
#include <arch/types.h>
#include <synch/synch.h>
#include <synch/waitq.h>
#include <typedefs.h>
#include <print.h>
 
/**
/trunk/kernel/arch/sparc64/src/smp/ipi.c
34,6 → 34,7
 
#include <smp/ipi.h>
#include <cpu.h>
#include <arch.h>
#include <arch/cpu.h>
#include <arch/asm.h>
#include <config.h>
/trunk/kernel/arch/sparc64/src/ddi/ddi.c
35,7 → 35,6
#include <ddi/ddi.h>
#include <proc/task.h>
#include <arch/types.h>
#include <typedefs.h>
 
/** Enable I/O space range for task.
*
/trunk/kernel/arch/sparc64/src/console.c
34,7 → 34,6
 
#include <arch/console.h>
#include <arch/types.h>
#include <typedefs.h>
 
#include <arch/drivers/scr.h>
#include <arch/drivers/kbd.h>
/trunk/kernel/arch/sparc64/src/trap/exception.c
40,7 → 40,6
#include <arch/asm.h>
#include <arch/register.h>
#include <debug.h>
#include <typedefs.h>
#include <symtab.h>
#include <print.h>
 
/trunk/kernel/arch/sparc64/src/trap/trap.c
43,7 → 43,6
#include <memstr.h>
#include <debug.h>
#include <arch/types.h>
#include <typedefs.h>
#include <arch/drivers/tick.h>
 
/** Initialize trap table. */
/trunk/kernel/arch/sparc64/src/trap/syscall.c
38,7 → 38,6
#include <syscall/syscall.h>
#include <panic.h>
#include <arch/types.h>
#include <typedefs.h>
 
unative_t syscall(int n, istate_t *istate, unative_t a1, unative_t a2, unative_t a3, unative_t a4)
{
/trunk/kernel/arch/sparc64/src/trap/interrupt.c
33,10 → 33,10
*/
 
#include <arch/interrupt.h>
#include <arch/sparc64.h>
#include <arch/trap/interrupt.h>
#include <interrupt.h>
#include <ddi/irq.h>
#include <typedefs.h>
#include <arch/types.h>
#include <debug.h>
#include <arch/asm.h>
/trunk/kernel/arch/sparc64/src/cpu/cpu.c
32,14 → 32,11
/** @file
*/
 
#include <arch/asm.h>
#include <cpu.h>
#include <arch.h>
#include <print.h>
#include <arch/register.h>
#include <genarch/ofw/ofw_tree.h>
#include <arch/types.h>
#include <arch/drivers/tick.h>
#include <print.h>
 
/** Perform sparc64 specific initialization of the processor structure for the
* current processor.
/trunk/kernel/arch/sparc64/src/mm/tlb.c
44,7 → 44,6
#include <arch.h>
#include <print.h>
#include <arch/types.h>
#include <typedefs.h>
#include <config.h>
#include <arch/trap/trap.h>
#include <arch/trap/exception.h>
/trunk/kernel/arch/sparc64/src/mm/as.c
34,7 → 34,7
 
#include <arch/mm/as.h>
#include <arch/mm/tlb.h>
#include <genarch/mm/as_ht.h>
#include <genarch/mm/page_ht.h>
#include <genarch/mm/asid_fifo.h>
#include <debug.h>
#include <config.h>
/trunk/kernel/arch/sparc64/src/mm/tsb.c
37,7 → 37,6
#include <arch/barrier.h>
#include <mm/as.h>
#include <arch/types.h>
#include <typedefs.h>
#include <macros.h>
#include <debug.h>
 
/trunk/kernel/arch/sparc64/src/mm/memory_init.c
34,7 → 34,6
 
#include <arch/mm/memory_init.h>
#include <arch/boot/boot.h>
#include <typedefs.h>
 
/** Return total size of available memory in bytes.
*
/trunk/kernel/arch/sparc64/src/drivers/fhc.c
41,10 → 41,9
 
#include <arch/drivers/fhc.h>
#include <arch/trap/interrupt.h>
#include <arch/mm/page.h>
#include <mm/page.h>
#include <mm/slab.h>
#include <arch/types.h>
#include <typedefs.h>
#include <genarch/ofw/ofw_tree.h>
 
fhc_t *central_fhc = NULL;
/trunk/kernel/arch/sparc64/src/drivers/kbd.c
44,7 → 44,6
#include <ddi/irq.h>
#include <arch/mm/page.h>
#include <arch/types.h>
#include <typedefs.h>
#include <align.h>
#include <func.h>
#include <print.h>
/trunk/kernel/arch/sparc64/src/drivers/scr.c
37,7 → 37,6
#include <genarch/fb/fb.h>
#include <genarch/fb/visuals.h>
#include <arch/types.h>
#include <typedefs.h>
#include <func.h>
#include <align.h>
#include <print.h>
/trunk/kernel/arch/sparc64/src/drivers/tick.c
34,9 → 34,9
 
#include <arch/drivers/tick.h>
#include <arch/interrupt.h>
#include <arch/sparc64.h>
#include <arch/asm.h>
#include <arch/register.h>
#include <typedefs.h>
#include <arch/cpu.h>
#include <arch/boot/boot.h>
#include <time/clock.h>
/trunk/kernel/arch/sparc64/src/drivers/pci.c
37,10 → 37,9
#include <arch/drivers/pci.h>
#include <genarch/ofw/ofw_tree.h>
#include <arch/trap/interrupt.h>
#include <arch/mm/page.h>
#include <mm/page.h>
#include <mm/slab.h>
#include <arch/types.h>
#include <typedefs.h>
#include <debug.h>
#include <print.h>
#include <func.h>
/trunk/kernel/arch/ia64/_link.ld.in
6,8 → 6,6
*
*/
 
#define __ASM__
 
ENTRY(kernel_image_start)
 
SECTIONS {
/trunk/kernel/arch/ia64/include/interrupt.h
35,7 → 35,6
#ifndef KERN_ia64_INTERRUPT_H_
#define KERN_ia64_INTERRUPT_H_
 
#include <typedefs.h>
#include <arch/types.h>
#include <arch/register.h>
 
64,37 → 63,37
 
#define EOI 0 /**< The actual value doesn't matter. */
 
struct istate {
__r128 f2;
__r128 f3;
__r128 f4;
__r128 f5;
__r128 f6;
__r128 f7;
__r128 f8;
__r128 f9;
__r128 f10;
__r128 f11;
__r128 f12;
__r128 f13;
__r128 f14;
__r128 f15;
__r128 f16;
__r128 f17;
__r128 f18;
__r128 f19;
__r128 f20;
__r128 f21;
__r128 f22;
__r128 f23;
__r128 f24;
__r128 f25;
__r128 f26;
__r128 f27;
__r128 f28;
__r128 f29;
__r128 f30;
__r128 f31;
typedef struct {
uint128_t f2;
uint128_t f3;
uint128_t f4;
uint128_t f5;
uint128_t f6;
uint128_t f7;
uint128_t f8;
uint128_t f9;
uint128_t f10;
uint128_t f11;
uint128_t f12;
uint128_t f13;
uint128_t f14;
uint128_t f15;
uint128_t f16;
uint128_t f17;
uint128_t f18;
uint128_t f19;
uint128_t f20;
uint128_t f21;
uint128_t f22;
uint128_t f23;
uint128_t f24;
uint128_t f25;
uint128_t f26;
uint128_t f27;
uint128_t f28;
uint128_t f29;
uint128_t f30;
uint128_t f31;
uintptr_t ar_bsp;
uintptr_t ar_bspstore;
119,7 → 118,7
uint64_t in2;
uint64_t in3;
uint64_t in4;
};
} istate_t;
 
static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr)
{
/trunk/kernel/arch/ia64/include/fpu_context.h
43,7 → 43,7
#define FRS 96
 
typedef struct {
__r128 fr[FRS];
uint128_t fr[FRS];
} fpu_context_t;
 
#endif
/trunk/kernel/arch/ia64/include/types.h
35,26 → 35,31
#ifndef KERN_ia64_TYPES_H_
#define KERN_ia64_TYPES_H_
 
#define NULL 0
#define NULL 0
#define false 0
#define true 1
 
typedef signed char int8_t;
typedef signed short int int16_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef signed long int64_t;
typedef struct {
int64_t lo;
int64_t hi;
} int128_t;
 
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long uint64_t;
typedef struct {
uint64_t lo;
uint64_t hi;
} uint128_t;
 
typedef unsigned char __r8; /* Reserve byte */
typedef unsigned short __r16;
typedef unsigned int __r32;
typedef unsigned long __r64;
typedef struct __r128 {
__r64 lo;
__r64 hi;
} __r128;
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;
64,8 → 69,13
typedef uint64_t unative_t;
typedef int64_t native_t;
 
typedef struct pte 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;
 
#endif
 
/** @}
/trunk/kernel/arch/ia64/include/mm/page.h
85,12 → 85,12
 
#ifndef __ASM__
 
#include <arch/mm/as.h>
#include <arch/mm/frame.h>
#include <arch/interrupt.h>
#include <arch/barrier.h>
#include <genarch/mm/page_ht.h>
#include <arch/mm/asid.h>
#include <arch/types.h>
#include <typedefs.h>
#include <debug.h>
 
struct vhpt_tag_info {
/trunk/kernel/arch/ia64/include/mm/tlb.h
42,7 → 42,6
#include <arch/mm/asid.h>
#include <arch/interrupt.h>
#include <arch/types.h>
#include <typedefs.h>
 
/** Data and instruction Translation Register indices. */
#define DTR_KERNEL 0
/trunk/kernel/arch/ia64/include/mm/as.h
47,6 → 47,8
typedef struct {
} as_arch_t;
 
#include <genarch/mm/as_ht.h>
 
#define as_constructor_arch(as, flags) (as != as)
#define as_destructor_arch(as) (as != as)
#define as_create_arch(as, flags) (as != as)
/trunk/kernel/arch/ia64/include/context.h
37,7 → 37,6
 
#include <arch/types.h>
#include <arch/register.h>
#include <typedefs.h>
#include <align.h>
#include <arch/stack.h>
 
47,7 → 46,7
*
* One item is put onto the stack to support get_stack_base().
*/
#define SP_DELTA (0+ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
#define SP_DELTA (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
 
#ifdef context_set
#undef context_set
105,27 → 104,27
*/
uint64_t pr;
 
__r128 f2 __attribute__ ((aligned(16)));
__r128 f3;
__r128 f4;
__r128 f5;
uint128_t f2 __attribute__ ((aligned(16)));
uint128_t f3;
uint128_t f4;
uint128_t f5;
 
__r128 f16;
__r128 f17;
__r128 f18;
__r128 f19;
__r128 f20;
__r128 f21;
__r128 f22;
__r128 f23;
__r128 f24;
__r128 f25;
__r128 f26;
__r128 f27;
__r128 f28;
__r128 f29;
__r128 f30;
__r128 f31;
uint128_t f16;
uint128_t f17;
uint128_t f18;
uint128_t f19;
uint128_t f20;
uint128_t f21;
uint128_t f22;
uint128_t f23;
uint128_t f24;
uint128_t f25;
uint128_t f26;
uint128_t f27;
uint128_t f28;
uint128_t f29;
uint128_t f30;
uint128_t f31;
ipl_t ipl;
} context_t;
/trunk/kernel/arch/ia64/include/cpu.h
36,8 → 36,8
#define KERN_ia64_CPU_H_
 
#include <arch/types.h>
#include <typedefs.h>
#include <arch/register.h>
#include <arch/asm.h>
 
#define FAMILY_ITANIUM 0x7
#define FAMILY_ITANIUM2 0x1f
/trunk/kernel/arch/ia64/src/ski/ski.c
38,7 → 38,6
#include <arch/interrupt.h>
#include <sysinfo/sysinfo.h>
#include <arch/types.h>
#include <typedefs.h>
#include <ddi/device.h>
#include <ddi/irq.h>
#include <ipc/irq.h>
/trunk/kernel/arch/ia64/src/ddi/ddi.c
35,7 → 35,6
#include <ddi/ddi.h>
#include <proc/task.h>
#include <arch/types.h>
#include <typedefs.h>
 
/** Enable I/O space range for task.
*
/trunk/kernel/arch/ia64/src/mm/tlb.c
47,7 → 47,6
#include <arch/interrupt.h>
#include <arch/pal/pal.h>
#include <arch/asm.h>
#include <typedefs.h>
#include <panic.h>
#include <print.h>
#include <arch.h>
/trunk/kernel/arch/ia64/src/mm/vhpt.c
32,6 → 32,7
/** @file
*/
 
#include <memstr.h>
#include <arch/mm/vhpt.h>
#include <mm/frame.h>
#include <print.h>
40,8 → 41,8
 
uintptr_t vhpt_set_up(void)
{
vhpt_base = frame_alloc(VHPT_WIDTH-FRAME_WIDTH,FRAME_KA | FRAME_ATOMIC);
if(!vhpt_base)
vhpt_base = frame_alloc(VHPT_WIDTH - FRAME_WIDTH, FRAME_KA | FRAME_ATOMIC);
if (!vhpt_base)
panic("Kernel configured with VHPT but no memory for table.");
vhpt_invalidate_all();
return (uintptr_t) vhpt_base;
61,28 → 62,26
vrn = va >> VRN_SHIFT;
rid = ASID2RID(asid, vrn);
rr_save.word = rr_read(vrn);
rr.word = rr_save.word;
rr.map.rid = rid;
rr_write(vrn, rr.word);
srlz_i();
rr_save.word = rr_read(vrn);
rr.word = rr_save.word;
rr.map.rid = rid;
rr_write(vrn, rr.word);
srlz_i();
ventry = (vhpt_entry_t *) thash(va);
tag = ttag(va);
rr_write(vrn, rr_save.word);
srlz_i();
srlz_d();
tag = ttag(va);
rr_write(vrn, rr_save.word);
srlz_i();
srlz_d();
 
ventry->word[0]=entry.word[0];
ventry->word[1]=entry.word[1];
ventry->word[0] = entry.word[0];
ventry->word[1] = entry.word[1];
ventry->present.tag.tag_word = tag;
 
}
 
void vhpt_invalidate_all()
{
memsetb((uintptr_t)vhpt_base,1<<VHPT_WIDTH,0);
memsetb((uintptr_t) vhpt_base, 1 << VHPT_WIDTH, 0);
}
 
void vhpt_invalidate_asid(asid_t asid)
/trunk/kernel/arch/ia64/src/mm/page.c
39,7 → 39,6
#include <arch/mm/asid.h>
#include <arch/mm/vhpt.h>
#include <arch/types.h>
#include <typedefs.h>
#include <print.h>
#include <mm/page.h>
#include <mm/frame.h>
/trunk/kernel/arch/ppc32/_link.ld.in
9,7 → 9,6
*
*/
 
#define __ASM__
#include <arch/boot/boot.h>
#include <arch/mm/page.h>
 
/trunk/kernel/arch/ppc32/include/exception.h
36,9 → 36,8
#define KERN_ppc32_EXCEPTION_H_
 
#include <arch/types.h>
#include <typedefs.h>
 
struct istate {
typedef struct {
uint32_t r0;
uint32_t r2;
uint32_t r3;
77,7 → 76,7
uint32_t xer;
uint32_t r12;
uint32_t sp;
};
} istate_t;
 
static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr)
{
/trunk/kernel/arch/ppc32/include/types.h
36,6 → 36,8
#define KERN_ppc32_TYPES_H_
 
#define NULL 0
#define false 0
#define true 1
 
typedef signed char int8_t;
typedef signed short int16_t;
47,6 → 49,10
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
 
typedef uint32_t size_t;
typedef uint32_t count_t;
typedef uint32_t index_t;
 
typedef uint32_t uintptr_t;
typedef uint32_t pfn_t;
 
53,7 → 59,15
typedef uint32_t ipl_t;
 
typedef uint32_t unative_t;
typedef int32_t native_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 p : 1; /**< Present bit. */
/trunk/kernel/arch/ppc32/include/mm/memory_init.h
35,8 → 35,6
#ifndef KERN_ppc32_MEMORY_INIT_H_
#define KERN_ppc32_MEMORY_INIT_H_
 
#include <typedefs.h>
 
size_t get_memory_size(void);
 
void memory_print_map(void);
/trunk/kernel/arch/ppc32/include/mm/page.h
104,9 → 104,8
 
#ifndef __ASM__
 
#include <mm/page.h>
#include <arch/mm/frame.h>
#include <arch/types.h>
#include <mm/mm.h>
#include <arch/interrupt.h>
 
static inline int get_pt_flags(pte_t *pt, index_t i)
{
/trunk/kernel/arch/ppc32/include/mm/tlb.h
35,6 → 35,8
#ifndef KERN_ppc32_TLB_H_
#define KERN_ppc32_TLB_H_
 
#include <arch/interrupt.h>
 
typedef struct {
unsigned v : 1; /**< Valid */
unsigned vsid : 24; /**< Virtual Segment ID */
/trunk/kernel/arch/ppc32/include/mm/as.h
42,11 → 42,13
#define USER_ADDRESS_SPACE_START_ARCH ((unsigned long) 0x00000000)
#define USER_ADDRESS_SPACE_END_ARCH ((unsigned long) 0x7fffffff)
 
#define USTACK_ADDRESS_ARCH (0x7fffffff-(PAGE_SIZE-1))
#define USTACK_ADDRESS_ARCH (0x7fffffff - (PAGE_SIZE - 1))
 
typedef struct {
} as_arch_t;
 
#include <genarch/mm/as_pt.h>
 
#define as_constructor_arch(as, flags) (as != as)
#define as_destructor_arch(as) (as != as)
#define as_create_arch(as, flags) (as != as)
/trunk/kernel/arch/ppc32/include/cpu.h
35,7 → 35,7
#ifndef KERN_ppc32_CPU_H_
#define KERN_ppc32_CPU_H_
 
#include <typedefs.h>
#include <arch/asm.h>
 
typedef struct {
int version;
/trunk/kernel/arch/ppc32/include/drivers/pic.h
35,6 → 35,8
#ifndef KERN_ppc32_PIC_H_
#define KERN_ppc32_PIC_H_
 
#include <arch/types.h>
 
#define PIC_PENDING_LOW 8
#define PIC_PENDING_HIGH 4
#define PIC_MASK_LOW 9
/trunk/kernel/arch/ppc32/include/drivers/cuda.h
36,7 → 36,6
#define KERN_ppc32_CUDA_H_
 
#include <arch/types.h>
#include <typedefs.h>
 
extern void cuda_init(devno_t devno, uintptr_t base, size_t size);
extern int cuda_get_scancode(void);
/trunk/kernel/arch/ppc32/src/ddi/ddi.c
35,7 → 35,6
#include <ddi/ddi.h>
#include <proc/task.h>
#include <arch/types.h>
#include <typedefs.h>
 
/** Enable I/O space range for task.
*
/trunk/kernel/arch/ppc32/src/cpu/cpu.c
35,10 → 35,7
#include <arch/cpu.h>
#include <arch/cpuid.h>
#include <cpu.h>
 
#include <arch.h>
 
#include <typedefs.h>
#include <print.h>
 
void cpu_arch_init(void)
/trunk/kernel/arch/ppc32/src/ppc32.c
32,6 → 32,7
/** @file
*/
 
#include <config.h>
#include <arch.h>
#include <arch/boot/boot.h>
#include <arch/drivers/cuda.h>
/trunk/kernel/arch/ppc32/src/mm/memory_init.c
34,7 → 34,6
 
#include <arch/boot/boot.h>
#include <arch/mm/memory_init.h>
#include <typedefs.h>
#include <print.h>
 
 
/trunk/kernel/arch/ppc32/src/drivers/pic.c
33,8 → 33,8
*/
 
 
#include <arch/asm.h>
#include <arch/drivers/pic.h>
#include <mm/page.h>
#include <byteorder.h>
#include <bitops.h>
 
/trunk/kernel/arch/ppc32/src/drivers/cuda.c
33,7 → 33,7
*/
 
#include <arch/drivers/cuda.h>
#include <ddi/irq.h>
#include <ipc/irq.h>
#include <arch/asm.h>
#include <console/console.h>
#include <console/chardev.h>
/trunk/kernel/arch/ia32xen/_link.ld.in
1,8 → 1,7
/** ia32xen linker script
*/
 
#define __ASM__
#include <arch/boot/boot.h>
#include <arch/hypercall.h>
#include <arch/mm/page.h>
 
ENTRY(kernel_image_start)
/trunk/kernel/arch/ia32xen/include/boot/boot.h
File deleted
/trunk/kernel/arch/ia32xen/include/types.h
36,6 → 36,8
#define KERN_ia32xen_TYPES_H_
 
#define NULL 0
#define false 0
#define true 1
 
typedef signed char int8_t;
typedef signed short int16_t;
47,6 → 49,10
typedef unsigned long uint32_t;
typedef unsigned long long uint64_t;
 
typedef uint32_t size_t;
typedef uint32_t count_t;
typedef uint32_t index_t;
 
typedef uint32_t uintptr_t;
typedef uint32_t pfn_t;
 
55,8 → 61,29
typedef uint32_t unative_t;
typedef int32_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 pat : 1;
unsigned global : 1;
unsigned soft_valid : 1; /**< Valid content even if the present bit is not set. */
unsigned avl : 2;
unsigned frame_address : 20;
} __attribute__ ((packed)) pte_t;
 
#endif
 
/** @}
/trunk/kernel/arch/ia32xen/include/pm.h
69,7 → 69,6
#ifndef __ASM__
 
#include <arch/types.h>
#include <typedefs.h>
#include <arch/context.h>
 
struct ptr_16_32 {
/trunk/kernel/arch/ia32xen/include/hypercall.h
29,31 → 29,42
#ifndef KERN_ia32xen_HYPERCALL_H_
#define KERN_ia32xen_HYPERCALL_H_
 
#include <arch/types.h>
#include <macros.h>
#ifndef __ASM__
# include <arch/types.h>
# include <macros.h>
#endif
 
typedef uint16_t domid_t;
#define GUEST_CMDLINE 1024
#define VIRT_CPUS 32
#define START_INFO_SIZE 1104
 
typedef struct {
uint8_t vector; /**< Exception vector */
uint8_t flags; /**< 0-3: privilege level; 4: clear event enable */
uint16_t cs; /**< Code selector */
void *address; /**< Code offset */
} trap_info_t;
#define BOOT_OFFSET 0x0000
#define TEMP_STACK_SIZE 0x1000
 
#define XEN_VIRT_START 0xFC000000
#define XEN_CS 0xe019
 
typedef struct {
evtchn_t port;
} evtchn_send_t;
#define XEN_ELFNOTE_INFO 0
#define XEN_ELFNOTE_ENTRY 1
#define XEN_ELFNOTE_HYPERCALL_PAGE 2
#define XEN_ELFNOTE_VIRT_BASE 3
#define XEN_ELFNOTE_PADDR_OFFSET 4
#define XEN_ELFNOTE_XEN_VERSION 5
#define XEN_ELFNOTE_GUEST_OS 6
#define XEN_ELFNOTE_GUEST_VERSION 7
#define XEN_ELFNOTE_LOADER 8
#define XEN_ELFNOTE_PAE_MODE 9
#define XEN_ELFNOTE_FEATURES 10
#define XEN_ELFNOTE_BSD_SYMTAB 11
 
typedef struct {
uint32_t cmd;
union {
evtchn_send_t send;
};
} evtchn_op_t;
#define mp_map ((pfn_t *) XEN_VIRT_START)
 
#define SIF_PRIVILEGED (1 << 0) /**< Privileged domain */
#define SIF_INITDOMAIN (1 << 1) /**< Iinitial control domain */
 
#define XEN_CONSOLE_VGA 0x03
#define XEN_CONSOLE_VESA 0x23
 
#define XEN_SET_TRAP_TABLE 0
#define XEN_MMU_UPDATE 1
#define XEN_SET_CALLBACKS 4
103,7 → 114,139
#define DOMID_SELF (0x7FF0U)
#define DOMID_IO (0x7FF1U)
 
#ifndef __ASM__
 
typedef uint16_t domid_t;
typedef uint32_t evtchn_t;
 
typedef struct {
uint32_t version;
uint32_t pad0;
uint64_t tsc_timestamp; /**< TSC at last update of time vals */
uint64_t system_time; /**< Time, in nanosecs, since boot */
uint32_t tsc_to_system_mul;
int8_t tsc_shift;
int8_t pad1[3];
} vcpu_time_info_t;
 
typedef struct {
uint32_t cr2;
uint32_t pad[5];
} arch_vcpu_info_t;
 
typedef struct arch_shared_info {
pfn_t max_pfn; /**< max pfn that appears in table */
uint32_t pfn_to_mfn_frame_list_list;
uint32_t nmi_reason;
} arch_shared_info_t;
 
typedef struct {
uint8_t evtchn_upcall_pending;
ipl_t evtchn_upcall_mask;
evtchn_t evtchn_pending_sel;
arch_vcpu_info_t arch;
vcpu_time_info_t time;
} vcpu_info_t;
 
typedef struct {
vcpu_info_t vcpu_info[VIRT_CPUS];
evtchn_t evtchn_pending[32];
evtchn_t evtchn_mask[32];
uint32_t wc_version; /**< Version counter */
uint32_t wc_sec; /**< Secs 00:00:00 UTC, Jan 1, 1970 */
uint32_t wc_nsec; /**< Nsecs 00:00:00 UTC, Jan 1, 1970 */
arch_shared_info_t arch;
} shared_info_t;
 
typedef struct {
int8_t magic[32]; /**< "xen-<version>-<platform>" */
uint32_t frames; /**< Available frames */
shared_info_t *shared_info; /**< Shared info structure (machine address) */
uint32_t flags; /**< SIF_xxx flags */
pfn_t store_mfn; /**< Shared page (machine page) */
evtchn_t store_evtchn; /**< Event channel for store communication */
union {
struct {
pfn_t mfn; /**< Console page (machine page) */
evtchn_t evtchn; /**< Event channel for console messages */
} domU;
struct {
uint32_t info_off; /**< Offset of console_info struct */
uint32_t info_size; /**< Size of console_info struct from start */
} dom0;
} console;
pte_t *ptl0; /**< Boot PTL0 (kernel address) */
uint32_t pt_frames; /**< Number of bootstrap page table frames */
pfn_t *pm_map; /**< Physical->machine frame map (kernel address) */
void *mod_start; /**< Modules start (kernel address) */
uint32_t mod_len; /**< Modules size (bytes) */
int8_t cmd_line[GUEST_CMDLINE];
} start_info_t;
 
typedef struct {
uint8_t video_type;
 
union {
struct {
uint16_t font_height;
uint16_t cursor_x;
uint16_t cursor_y;
uint16_t rows;
uint16_t columns;
} vga;
 
struct {
uint16_t width;
uint16_t height;
uint16_t bytes_per_line;
uint16_t bits_per_pixel;
uint32_t lfb_base;
uint32_t lfb_size;
uint8_t red_pos;
uint8_t red_size;
uint8_t green_pos;
uint8_t green_size;
uint8_t blue_pos;
uint8_t blue_size;
uint8_t rsvd_pos;
uint8_t rsvd_size;
} vesa_lfb;
} info;
} console_info_t;
 
typedef struct {
pfn_t start;
pfn_t size;
pfn_t reserved;
} memzone_t;
 
extern start_info_t start_info;
extern shared_info_t shared_info;
extern memzone_t meminfo;
 
typedef struct {
uint8_t vector; /**< Exception vector */
uint8_t flags; /**< 0-3: privilege level; 4: clear event enable */
uint16_t cs; /**< Code selector */
void *address; /**< Code offset */
} trap_info_t;
 
typedef struct {
evtchn_t port;
} evtchn_send_t;
 
typedef struct {
uint32_t cmd;
union {
evtchn_send_t send;
};
} evtchn_op_t;
 
#define force_evtchn_callback() ((void) xen_version(0, 0))
 
#define hypercall0(id) \
234,3 → 377,5
}
 
#endif
 
#endif
/trunk/kernel/arch/ia32xen/include/mm/frame.h
42,9 → 42,6
#ifdef KERNEL
#ifndef __ASM__
 
#include <arch/types.h>
#include <arch/boot/boot.h>
 
#define PA2MA(x) ((start_info.pm_map[((uintptr_t) (x)) >> 12] << 12) + (((uintptr_t) (x)) & 0xfff))
#define MA2PA(x) ((mp_map[((uintptr_t) (x)) >> 12] << 12) + (((uintptr_t) (x)) & 0xfff))
 
/trunk/kernel/arch/ia32xen/include/mm/memory_init.h
36,7 → 36,7
#ifndef KERN_ia32xen_MEMORY_INIT_H_
#define KERN_ia32xen_MEMORY_INIT_H_
 
#include <typedefs.h>
#include <arch/types.h>
 
size_t get_memory_size(void);
 
/trunk/kernel/arch/ia32xen/include/mm/page.h
121,11 → 121,9
 
#ifndef __ASM__
 
#include <mm/page.h>
#include <arch/types.h>
#include <arch/mm/frame.h>
#include <typedefs.h>
#include <mm/mm.h>
#include <arch/hypercall.h>
#include <arch/interrupt.h>
 
/* Page fault error codes. */
 
141,22 → 139,6
/** When bit on this position is 1, a reserved bit was set in page directory. */
#define PFERR_CODE_RSVD (1 << 3)
 
/** 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 pat : 1;
unsigned global : 1;
unsigned soft_valid : 1; /**< Valid content even if the present bit is not set. */
unsigned avl : 2;
unsigned frame_address : 20;
} __attribute__ ((packed));
 
typedef struct {
uint64_t ptr; /**< Machine address of PTE */
union { /**< New contents of PTE */
/trunk/kernel/arch/ia32xen/include/mm/as.h
47,6 → 47,8
typedef struct {
} as_arch_t;
 
#include <genarch/mm/as_pt.h>
 
#define as_constructor_arch(as, flags) (as != as)
#define as_destructor_arch(as) (as != as)
#define as_create_arch(as, flags) (as != as)
/trunk/kernel/arch/ia32xen/src/ia32xen.c
36,7 → 36,6
#include <main/main.h>
 
#include <arch/types.h>
#include <typedefs.h>
#include <align.h>
 
#include <arch/pm.h>
54,7 → 53,6
 
#include <arch/bios/bios.h>
 
#include <arch/boot/boot.h>
#include <arch/mm/memory_init.h>
#include <interrupt.h>
#include <arch/debugger.h>
/trunk/kernel/arch/ia32xen/src/pm.c
35,7 → 35,6
#include <arch/pm.h>
#include <config.h>
#include <arch/types.h>
#include <typedefs.h>
#include <arch/interrupt.h>
#include <arch/asm.h>
#include <arch/context.h>
43,7 → 42,6
#include <arch/mm/page.h>
#include <mm/slab.h>
#include <memstr.h>
#include <arch/boot/boot.h>
#include <interrupt.h>
 
/*
/trunk/kernel/arch/ia32xen/src/smp/mps.c
42,7 → 42,6
#include <arch/smp/smp.h>
#include <func.h>
#include <arch/types.h>
#include <typedefs.h>
#include <cpu.h>
#include <arch/asm.h>
#include <arch/bios/bios.h>
/trunk/kernel/arch/ia32xen/src/smp/smp.c
36,7 → 36,6
#include <arch/smp/smp.h>
#include <arch/smp/mps.h>
#include <arch/smp/ap.h>
#include <arch/boot/boot.h>
#include <genarch/acpi/acpi.h>
#include <genarch/acpi/madt.h>
#include <config.h>
/trunk/kernel/arch/ia32xen/src/smp/apic.c
36,7 → 36,6
#include <arch/smp/apic.h>
#include <arch/smp/ap.h>
#include <arch/smp/mps.h>
#include <arch/boot/boot.h>
#include <mm/page.h>
#include <time/delay.h>
#include <interrupt.h>
/trunk/kernel/arch/ia32xen/src/boot/boot.S
26,9 → 26,8
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
 
#include <arch/boot/boot.h>
#include <arch/mm/page.h>
#include <arch/pm.h>
#include <arch/hypercall.h>
 
#define ELFNOTE(name, type, desctype, descval) \
.section .note.name; \
/trunk/kernel/arch/ia32xen/src/mm/as.c
34,7 → 34,7
*/
 
#include <arch/mm/as.h>
#include <genarch/mm/as_pt.h>
#include <genarch/mm/page_pt.h>
 
/** Architecture dependent address space init. */
void as_arch_init(void)
/trunk/kernel/arch/ia32xen/src/mm/memory_init.c
34,7 → 34,6
 
#include <arch/mm/memory_init.h>
#include <arch/mm/page.h>
#include <arch/boot/boot.h>
#include <print.h>
#include <mm/frame.h>
 
/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)
/trunk/kernel/arch/ppc64/_link.ld.in
9,7 → 9,6
*
*/
 
#define __ASM__
#include <arch/boot/boot.h>
#include <arch/mm/page.h>
 
/trunk/kernel/arch/ppc64/include/exception.h
36,9 → 36,8
#define KERN_ppc64_EXCEPTION_H_
 
#include <arch/types.h>
#include <typedefs.h>
 
struct istate {
typedef struct {
uint64_t r0;
uint64_t r2;
uint64_t r3;
77,7 → 76,7
uint64_t xer;
uint64_t r12;
uint64_t sp;
};
} istate_t;
 
static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr)
{
/trunk/kernel/arch/ppc64/include/types.h
36,6 → 36,8
#define KERN_ppc64_TYPES_H_
 
#define NULL 0
#define false 0
#define true 1
 
typedef signed char int8_t;
typedef signed short int16_t;
47,6 → 49,10
typedef unsigned int uint32_t;
typedef unsigned 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;
 
53,7 → 59,15
typedef uint64_t ipl_t;
 
typedef uint64_t unative_t;
typedef int64_t native_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 p : 1; /**< Present bit. */
/trunk/kernel/arch/ppc64/include/mm/memory_init.h
35,8 → 35,6
#ifndef KERN_ppc64_MEMORY_INIT_H_
#define KERN_ppc64_MEMORY_INIT_H_
 
#include <typedefs.h>
 
size_t get_memory_size(void);
 
void memory_print_map(void);
/trunk/kernel/arch/ppc64/include/mm/page.h
104,9 → 104,8
 
#ifndef __ASM__
 
#include <mm/page.h>
#include <arch/mm/frame.h>
#include <arch/types.h>
#include <mm/mm.h>
#include <arch/interrupt.h>
 
static inline int get_pt_flags(pte_t *pt, index_t i)
{
/trunk/kernel/arch/ppc64/include/mm/as.h
42,11 → 42,13
#define USER_ADDRESS_SPACE_START_ARCH ((unsigned long) 0x00000000)
#define USER_ADDRESS_SPACE_END_ARCH ((unsigned long) 0x7fffffff)
 
#define USTACK_ADDRESS_ARCH (0x7fffffff-(PAGE_SIZE-1))
#define USTACK_ADDRESS_ARCH (0x7fffffff - (PAGE_SIZE - 1))
 
typedef struct {
} as_arch_t;
 
#include <genarch/mm/as_pt.h>
 
#define as_constructor_arch(as, flags) (as != as)
#define as_destructor_arch(as) (as != as)
#define as_create_arch(as, flags) (as != as)
/trunk/kernel/arch/ppc64/include/cpu.h
35,7 → 35,7
#ifndef KERN_ppc64_CPU_H_
#define KERN_ppc64_CPU_H_
 
#include <typedefs.h>
#include <arch/asm.h>
 
typedef struct {
int version;
/trunk/kernel/arch/ppc64/include/drivers/pic.h
35,6 → 35,8
#ifndef KERN_ppc64_PIC_H_
#define KERN_ppc64_PIC_H_
 
#include <arch/types.h>
 
#define PIC_PENDING_LOW 8
#define PIC_PENDING_HIGH 4
#define PIC_MASK_LOW 9
/trunk/kernel/arch/ppc64/src/ddi/ddi.c
35,7 → 35,6
#include <ddi/ddi.h>
#include <proc/task.h>
#include <arch/types.h>
#include <typedefs.h>
 
/** Enable I/O space range for task.
*
/trunk/kernel/arch/ppc64/src/cpu/cpu.c
35,10 → 35,7
#include <arch/cpu.h>
#include <arch/cpuid.h>
#include <cpu.h>
 
#include <arch.h>
 
#include <typedefs.h>
#include <print.h>
 
void cpu_arch_init(void)
/trunk/kernel/arch/ppc64/src/mm/as.c
33,7 → 33,7
*/
 
#include <arch/mm/as.h>
#include <genarch/mm/as_pt.h>
#include <genarch/mm/page_pt.h>
 
/** Architecture dependent address space init. */
void as_arch_init(void)
/trunk/kernel/arch/ppc64/src/mm/memory_init.c
34,7 → 34,6
 
#include <arch/boot/boot.h>
#include <arch/mm/memory_init.h>
#include <typedefs.h>
#include <print.h>
 
 
/trunk/kernel/arch/ppc64/src/drivers/pic.c
33,8 → 33,8
*/
 
 
#include <arch/asm.h>
#include <arch/drivers/pic.h>
#include <mm/page.h>
#include <byteorder.h>
#include <bitops.h>
 
/trunk/kernel/arch/mips32/include/context_offset.h
42,7 → 42,7
#define OFFSET_S8 0x28
#define OFFSET_GP 0x2c
 
/* struct istate */
/* istate_t */
#define EOFFSET_AT 0x0
#define EOFFSET_V0 0x4
#define EOFFSET_V1 0x8
/trunk/kernel/arch/mips32/include/interrupt.h
35,6 → 35,7
#ifndef KERN_mips32_INTERRUPT_H_
#define KERN_mips32_INTERRUPT_H_
 
#include <typedefs.h>
#include <arch/exception.h>
 
#define IVT_ITEMS 32
/trunk/kernel/arch/mips32/include/exception.h
36,7 → 36,6
#define KERN_mips32_EXCEPTION_H_
 
#include <arch/types.h>
#include <typedefs.h>
#include <arch/cp0.h>
 
#define EXC_Int 0
58,7 → 57,7
#define EXC_WATCH 23
#define EXC_VCED 31
 
struct istate {
typedef struct {
uint32_t at;
uint32_t v0;
uint32_t v1;
95,7 → 94,7
uint32_t status; /* cp0_status */
uint32_t epc; /* cp0_epc */
uint32_t k1; /* We use it as thread-local pointer */
};
} istate_t;
 
static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr)
{
/trunk/kernel/arch/mips32/include/cache.h
35,7 → 35,7
#ifndef KERN_mips32_CACHE_H_
#define KERN_mips32_CACHE_H_
 
#include <typedefs.h>
#include <arch/exception.h>
 
extern void cache_error(istate_t *istate);
 
/trunk/kernel/arch/mips32/include/types.h
35,21 → 35,26
#ifndef KERN_mips32_TYPES_H_
#define KERN_mips32_TYPES_H_
 
#define NULL 0
#define NULL 0
#define false 0
#define true 1
 
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed long int32_t;
typedef signed long long int64_t;
 
typedef unsigned char uint8_t;
 
typedef signed short int16_t;
typedef unsigned short uint16_t;
 
typedef unsigned long uint32_t;
typedef signed long int32_t;
 
typedef unsigned long long uint64_t;
typedef signed long long int64_t;
 
typedef uint32_t size_t;
typedef uint32_t count_t;
typedef uint32_t index_t;
 
typedef uint32_t uintptr_t;
typedef uint32_t pfn_t;
 
typedef uint32_t ipl_t;
 
56,10 → 61,26
typedef uint32_t unative_t;
typedef int32_t native_t;
 
typedef struct pte pte_t;
typedef uint8_t bool;
typedef uint64_t task_id_t;
typedef uint32_t context_id_t;
 
typedef uint32_t pfn_t;
typedef int32_t inr_t;
typedef int32_t devno_t;
 
/** Page Table Entry. */
typedef struct {
unsigned g : 1; /**< Global bit. */
unsigned p : 1; /**< Present bit. */
unsigned d : 1; /**< Dirty bit. */
unsigned cacheable : 1; /**< Cacheable bit. */
unsigned : 1; /**< Unused. */
unsigned soft_valid : 1; /**< Valid content even if not present. */
unsigned pfn : 24; /**< Physical frame number. */
unsigned w : 1; /**< Page writable bit. */
unsigned a : 1; /**< Accessed bit. */
} pte_t;
 
#endif
 
/** @}
/trunk/kernel/arch/mips32/include/asm.h
36,7 → 36,6
#define KERN_mips32_ASM_H_
 
#include <arch/types.h>
#include <typedefs.h>
#include <config.h>
 
 
/trunk/kernel/arch/mips32/include/cp0.h
36,14 → 36,13
#define KERN_mips32_CP0_H_
 
#include <arch/types.h>
#include <arch/mm/tlb.h>
 
#define cp0_status_ie_enabled_bit (1<<0)
#define cp0_status_exl_exception_bit (1<<1)
#define cp0_status_erl_error_bit (1<<2)
#define cp0_status_um_bit (1<<4)
#define cp0_status_bev_bootstrap_bit (1<<22)
#define cp0_status_fpu_bit (1<<29)
#define cp0_status_ie_enabled_bit (1 << 0)
#define cp0_status_exl_exception_bit (1 << 1)
#define cp0_status_erl_error_bit (1 << 2)
#define cp0_status_um_bit (1 << 4)
#define cp0_status_bev_bootstrap_bit (1 << 22)
#define cp0_status_fpu_bit (1 << 29)
 
#define cp0_status_im_shift 8
#define cp0_status_im_mask 0xff00
60,8 → 59,8
 
#define cp0_mask_all_int() cp0_status_write(cp0_status_read() & ~(cp0_status_im_mask))
#define cp0_unmask_all_int() cp0_status_write(cp0_status_read() | cp0_status_im_mask)
#define cp0_mask_int(it) cp0_status_write(cp0_status_read() & ~(1<<(cp0_status_im_shift+(it))))
#define cp0_unmask_int(it) cp0_status_write(cp0_status_read() | (1<<(cp0_status_im_shift+(it))))
#define cp0_mask_int(it) cp0_status_write(cp0_status_read() & ~(1 << (cp0_status_im_shift + (it))))
#define cp0_unmask_int(it) cp0_status_write(cp0_status_read() | (1 << (cp0_status_im_shift + (it))))
 
#define GEN_READ_CP0(nm,reg) static inline uint32_t cp0_ ##nm##_read(void) \
{ \
/trunk/kernel/arch/mips32/include/mm/page.h
43,11 → 43,11
#define PAGE_COLOR_BITS 0 /* dummy */
 
#ifndef __ASM__
# define KA2PA(x) (((uintptr_t) (x)) - 0x80000000)
# define PA2KA(x) (((uintptr_t) (x)) + 0x80000000)
# define KA2PA(x) (((uintptr_t) (x)) - 0x80000000)
# define PA2KA(x) (((uintptr_t) (x)) + 0x80000000)
#else
# define KA2PA(x) ((x) - 0x80000000)
# define PA2KA(x) ((x) + 0x80000000)
# define KA2PA(x) ((x) - 0x80000000)
# define PA2KA(x) ((x) + 0x80000000)
#endif
 
#ifdef KERNEL
109,10 → 109,8
 
#ifndef __ASM__
 
#include <arch/mm/tlb.h>
#include <mm/page.h>
#include <arch/mm/frame.h>
#include <arch/types.h>
#include <mm/mm.h>
#include <arch/exception.h>
 
static inline int get_pt_flags(pte_t *pt, index_t i)
{
/trunk/kernel/arch/mips32/include/mm/tlb.h
36,7 → 36,6
#define KERN_mips32_TLB_H_
 
#include <arch/exception.h>
#include <typedefs.h>
 
#ifdef TLBCNT
# define TLB_ENTRY_COUNT TLBCNT
52,12 → 51,7
#define PAGE_UNCACHED 2
#define PAGE_CACHEABLE_EXC_WRITE 5
 
typedef union entry_lo entry_lo_t;
typedef union entry_hi entry_hi_t;
typedef union page_mask page_mask_t;
typedef union index tlb_index_t;
 
union entry_lo {
typedef union {
struct {
#ifdef BIG_ENDIAN
unsigned : 2; /* zero */
76,22 → 70,9
#endif
} __attribute__ ((packed));
uint32_t value;
};
} entry_lo_t;
 
/** Page Table Entry. */
struct pte {
unsigned g : 1; /**< Global bit. */
unsigned p : 1; /**< Present bit. */
unsigned d : 1; /**< Dirty bit. */
unsigned cacheable : 1; /**< Cacheable bit. */
unsigned : 1; /**< Unused. */
unsigned soft_valid : 1; /**< Valid content even if not present. */
unsigned pfn : 24; /**< Physical frame number. */
unsigned w : 1; /**< Page writable bit. */
unsigned a : 1; /**< Accessed bit. */
};
 
union entry_hi {
typedef union {
struct {
#ifdef BIG_ENDIAN
unsigned vpn2 : 19;
104,9 → 85,9
#endif
} __attribute__ ((packed));
uint32_t value;
};
} entry_hi_t;
 
union page_mask {
typedef union {
struct {
#ifdef BIG_ENDIAN
unsigned : 7;
119,9 → 100,9
#endif
} __attribute__ ((packed));
uint32_t value;
};
} page_mask_t;
 
union index {
typedef union {
struct {
#ifdef BIG_ENDIAN
unsigned p : 1;
134,7 → 115,7
#endif
} __attribute__ ((packed));
uint32_t value;
};
} tlb_index_t;
 
/** Probe TLB for Matching Entry
*
/trunk/kernel/arch/mips32/include/mm/as.h
42,11 → 42,13
#define USER_ADDRESS_SPACE_START_ARCH (unsigned long) 0x00000000
#define USER_ADDRESS_SPACE_END_ARCH (unsigned long) 0x7fffffff
 
#define USTACK_ADDRESS_ARCH (0x80000000-PAGE_SIZE)
#define USTACK_ADDRESS_ARCH (0x80000000 - PAGE_SIZE)
 
typedef struct {
} as_arch_t;
 
#include <genarch/mm/as_pt.h>
 
#define as_constructor_arch(as, flags) (as != as)
#define as_destructor_arch(as) (as != as)
#define as_create_arch(as, flags) (as != as)
/trunk/kernel/arch/mips32/include/debugger.h
35,7 → 35,6
#ifndef KERN_mips32_DEBUGGER_H_
#define KERN_mips32_DEBUGGER_H_
 
#include <typedefs.h>
#include <arch/exception.h>
#include <arch/types.h>
 
/trunk/kernel/arch/mips32/include/cpu.h
36,6 → 36,7
#define KERN_mips32_CPU_H_
 
#include <arch/types.h>
#include <arch/asm.h>
 
typedef struct {
uint32_t imp_num;
/trunk/kernel/arch/mips32/src/exception.c
34,6 → 34,7
 
#include <arch/exception.h>
#include <arch/interrupt.h>
#include <arch/mm/tlb.h>
#include <panic.h>
#include <arch/cp0.h>
#include <arch/types.h>
/trunk/kernel/arch/mips32/src/cache.c
34,7 → 34,6
 
#include <arch/cache.h>
#include <arch/exception.h>
#include <typedefs.h>
#include <panic.h>
 
void cache_error(istate_t *istate)
/trunk/kernel/arch/mips32/src/cpu/cpu.c
34,12 → 34,8
 
#include <arch/cpu.h>
#include <cpu.h>
 
#include <arch.h>
 
#include <arch/cp0.h>
 
#include <typedefs.h>
#include <print.h>
 
struct data_t {
/trunk/kernel/arch/mips32/src/mips32.c
36,7 → 36,6
#include <arch/boot.h>
#include <arch/cp0.h>
#include <arch/exception.h>
#include <arch/asm.h>
#include <mm/as.h>
 
#include <userspace.h>
/trunk/kernel/arch/mips32/src/ddi/ddi.c
35,7 → 35,6
#include <ddi/ddi.h>
#include <proc/task.h>
#include <arch/types.h>
#include <typedefs.h>
#include <security/cap.h>
#include <arch.h>
#include <arch/cp0.h>
/trunk/kernel/arch/mips32/src/interrupt.c
41,7 → 41,6
#include <arch/drivers/arc.h>
#include <ipc/sysipc.h>
#include <ddi/device.h>
#include <ddi/irq.h>
 
#define IRQ_COUNT 8
#define TIMER_IRQ 7
/trunk/kernel/arch/mips32/src/drivers/serial.c
34,10 → 34,10
 
#include <interrupt.h>
#include <arch/cp0.h>
#include <ipc/irq.h>
#include <arch/drivers/serial.h>
#include <console/chardev.h>
#include <console/console.h>
#include <ddi/irq.h>
 
#define SERIAL_IRQ 2
 
/trunk/kernel/arch/mips32/src/drivers/msim.c
33,11 → 33,11
*/
 
#include <interrupt.h>
#include <ipc/irq.h>
#include <console/chardev.h>
#include <arch/drivers/msim.h>
#include <arch/cp0.h>
#include <console/console.h>
#include <ddi/irq.h>
#include <sysinfo/sysinfo.h>
 
/** Address of devices. */
/trunk/kernel/arch/ia32/_link.ld.in
8,7 → 8,6
* kernel data
*/
 
#define __ASM__
#include <arch/boot/boot.h>
#include <arch/mm/page.h>
 
/trunk/kernel/arch/ia32/include/interrupt.h
68,7 → 68,7
#define VECTOR_TLB_SHOOTDOWN_IPI (IVT_FREEBASE + 1)
#define VECTOR_DEBUG_IPI (IVT_FREEBASE + 2)
 
struct istate {
typedef struct {
uint32_t eax;
uint32_t ecx;
uint32_t edx;
87,7 → 87,7
uint32_t cs;
uint32_t eflags;
uint32_t stack[];
};
} istate_t;
 
/** Return true if exception happened while in userspace */
static inline int istate_from_uspace(istate_t *istate)
/trunk/kernel/arch/ia32/include/types.h
36,6 → 36,8
#define KERN_ia32_TYPES_H_
 
#define NULL 0
#define false 0
#define true 1
 
typedef signed char int8_t;
typedef signed short int16_t;
47,6 → 49,10
typedef unsigned long uint32_t;
typedef unsigned long long uint64_t;
 
typedef uint32_t size_t;
typedef uint32_t count_t;
typedef uint32_t index_t;
 
typedef uint32_t uintptr_t;
typedef uint32_t pfn_t;
 
55,8 → 61,29
typedef uint32_t unative_t;
typedef int32_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 pat : 1;
unsigned global : 1;
unsigned soft_valid : 1; /**< Valid content even if the present bit is not set. */
unsigned avl : 2;
unsigned frame_address : 20;
} __attribute__ ((packed)) pte_t;
 
#endif
 
/** @}
/trunk/kernel/arch/ia32/include/smp/apic.h
107,7 → 107,7
/** Interrupt Command Register. */
#define ICRlo (0x300/sizeof(uint32_t))
#define ICRhi (0x310/sizeof(uint32_t))
struct icr {
typedef struct {
union {
uint32_t lo;
struct {
130,8 → 130,7
uint8_t dest; /**< Destination field. */
} __attribute__ ((packed));
};
} __attribute__ ((packed));
typedef struct icr icr_t;
} __attribute__ ((packed)) icr_t;
 
/* End Of Interrupt. */
#define EOI (0x0b0/sizeof(uint32_t))
138,7 → 137,7
 
/** Error Status Register. */
#define ESR (0x280/sizeof(uint32_t))
union esr {
typedef union {
uint32_t value;
uint8_t err_bitmap;
struct {
152,23 → 151,21
unsigned illegal_register_address : 1;
unsigned : 24;
} __attribute__ ((packed));
};
typedef union esr esr_t;
} esr_t;
 
/* Task Priority Register */
#define TPR (0x080/sizeof(uint32_t))
union tpr {
typedef union {
uint32_t value;
struct {
unsigned pri_sc : 4; /**< Task Priority Sub-Class. */
unsigned pri : 4; /**< Task Priority. */
} __attribute__ ((packed));
};
typedef union tpr tpr_t;
} tpr_t;
 
/** Spurious-Interrupt Vector Register. */
#define SVR (0x0f0/sizeof(uint32_t))
union svr {
typedef union {
uint32_t value;
struct {
uint8_t vector; /**< Spurious Vector. */
176,19 → 173,17
unsigned focus_checking : 1; /**< Focus Processor Checking. */
unsigned : 22; /**< Reserved. */
} __attribute__ ((packed));
};
typedef union svr svr_t;
} svr_t;
 
/** Time Divide Configuration Register. */
#define TDCR (0x3e0/sizeof(uint32_t))
union tdcr {
typedef union {
uint32_t value;
struct {
unsigned div_value : 4; /**< Divide Value, bit 2 is always 0. */
unsigned : 28; /**< Reserved. */
} __attribute__ ((packed));
};
typedef union tdcr tdcr_t;
} tdcr_t;
 
/* Initial Count Register for Timer */
#define ICRT (0x380/sizeof(uint32_t))
198,7 → 193,7
 
/** LVT Timer register. */
#define LVT_Tm (0x320/sizeof(uint32_t))
union lvt_tm {
typedef union {
uint32_t value;
struct {
uint8_t vector; /**< Local Timer Interrupt vector. */
209,13 → 204,12
unsigned mode : 1; /**< Timer Mode. */
unsigned : 14; /**< Reserved. */
} __attribute__ ((packed));
};
typedef union lvt_tm lvt_tm_t;
} lvt_tm_t;
 
/** LVT LINT registers. */
#define LVT_LINT0 (0x350/sizeof(uint32_t))
#define LVT_LINT1 (0x360/sizeof(uint32_t))
union lvt_lint {
typedef union {
uint32_t value;
struct {
uint8_t vector; /**< LINT Interrupt vector. */
228,12 → 222,11
unsigned masked : 1; /**< Interrupt Mask. */
unsigned : 15; /**< Reserved. */
} __attribute__ ((packed));
};
typedef union lvt_lint lvt_lint_t;
} lvt_lint_t;
 
/** LVT Error register. */
#define LVT_Err (0x370/sizeof(uint32_t))
union lvt_error {
typedef union {
uint32_t value;
struct {
uint8_t vector; /**< Local Timer Interrupt vector. */
243,19 → 236,17
unsigned masked : 1; /**< Interrupt Mask. */
unsigned : 15; /**< Reserved. */
} __attribute__ ((packed));
};
typedef union lvt_error lvt_error_t;
} lvt_error_t;
 
/** Local APIC ID Register. */
#define L_APIC_ID (0x020/sizeof(uint32_t))
union l_apic_id {
typedef union {
uint32_t value;
struct {
unsigned : 24; /**< Reserved. */
uint8_t apic_id; /**< Local APIC ID. */
} __attribute__ ((packed));
};
typedef union l_apic_id l_apic_id_t;
} l_apic_id_t;
 
/** Local APIC Version Register */
#define LAVR (0x030/sizeof(uint32_t))
266,25 → 257,23
 
/** Logical Destination Register. */
#define LDR (0x0d0/sizeof(uint32_t))
union ldr {
typedef union {
uint32_t value;
struct {
unsigned : 24; /**< Reserved. */
uint8_t id; /**< Logical APIC ID. */
} __attribute__ ((packed));
};
typedef union ldr ldr_t;
} ldr_t;
 
/** Destination Format Register. */
#define DFR (0x0e0/sizeof(uint32_t))
union dfr {
typedef union {
uint32_t value;
struct {
unsigned : 28; /**< Reserved, all ones. */
unsigned model : 4; /**< Model. */
} __attribute__ ((packed));
};
typedef union dfr dfr_t;
} dfr_t;
 
/* IO APIC */
#define IOREGSEL (0x00/sizeof(uint32_t))
296,17 → 285,16
#define IOREDTBL 0x10
 
/** I/O Register Select Register. */
union io_regsel {
typedef union {
uint32_t value;
struct {
uint8_t reg_addr; /**< APIC Register Address. */
unsigned : 24; /**< Reserved. */
} __attribute__ ((packed));
};
typedef union io_regsel io_regsel_t;
} io_regsel_t;
 
/** I/O Redirection Register. */
struct io_redirection_reg {
typedef struct io_redirection_reg {
union {
uint32_t lo;
struct {
329,12 → 317,11
} __attribute__ ((packed));
};
} __attribute__ ((packed));
typedef struct io_redirection_reg io_redirection_reg_t;
} __attribute__ ((packed)) io_redirection_reg_t;
 
 
/** IO APIC Identification Register. */
union io_apic_id {
typedef union {
uint32_t value;
struct {
unsigned : 24; /**< Reserved. */
341,8 → 328,7
unsigned apic_id : 4; /**< IO APIC ID. */
unsigned : 4; /**< Reserved. */
} __attribute__ ((packed));
};
typedef union io_apic_id io_apic_id_t;
} io_apic_id_t;
 
extern volatile uint32_t *l_apic;
extern volatile uint32_t *io_apic;
/trunk/kernel/arch/ia32/include/smp/mps.h
36,7 → 36,6
#define KERN_ia32_MPS_H_
 
#include <arch/types.h>
#include <typedefs.h>
#include <synch/waitq.h>
#include <config.h>
#include <arch/smp/smp.h>
/trunk/kernel/arch/ia32/include/smp/smp.h
36,7 → 36,6
#define KERN_ia32_SMP_H_
 
#include <arch/types.h>
#include <typedefs.h>
 
/** SMP config opertaions interface. */
struct smp_config_operations {
/trunk/kernel/arch/ia32/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/ia32/include/pm.h
81,7 → 81,6
#ifndef __ASM__
 
#include <arch/types.h>
#include <typedefs.h>
#include <arch/context.h>
 
struct ptr_16_32 {
/trunk/kernel/arch/ia32/include/boot/memmap.h
57,18 → 57,16
 
#include <arch/types.h>
 
struct e820memmap_ {
typedef struct {
uint64_t base_address;
uint64_t size;
uint32_t type;
} __attribute__ ((packed));
} __attribute__ ((packed)) e820memmap_t;
 
extern struct e820memmap_ e820table[MEMMAP_E820_MAX_RECORDS];
 
extern e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS];
extern uint8_t e820counter;
extern uint32_t e801memorysize; /**< Size of available memory in KB. */
 
extern uint32_t e801memorysize; /**< Size of available memory in KB. */
 
#endif
 
#endif
/trunk/kernel/arch/ia32/include/proc/task.h
35,7 → 35,6
#ifndef KERN_ia32_TASK_H_
#define KERN_ia32_TASK_H_
 
#include <typedefs.h>
#include <arch/types.h>
#include <adt/bitmap.h>
 
/trunk/kernel/arch/ia32/include/mm/memory_init.h
36,8 → 36,6
#ifndef KERN_ia32_MEMORY_INIT_H_
#define KERN_ia32_MEMORY_INIT_H_
 
#include <typedefs.h>
 
size_t get_memory_size(void);
 
void memory_print_map(void);
/trunk/kernel/arch/ia32/include/mm/page.h
61,15 → 61,15
#define PTL2_ENTRIES_ARCH 0
#define PTL3_ENTRIES_ARCH 1024
 
#define PTL0_INDEX_ARCH(vaddr) (((vaddr)>>22)&0x3ff)
#define PTL0_INDEX_ARCH(vaddr) (((vaddr) >> 22) & 0x3ff)
#define PTL1_INDEX_ARCH(vaddr) 0
#define PTL2_INDEX_ARCH(vaddr) 0
#define PTL3_INDEX_ARCH(vaddr) (((vaddr)>>12)&0x3ff)
#define PTL3_INDEX_ARCH(vaddr) (((vaddr) >> 12) & 0x3ff)
 
#define GET_PTL1_ADDRESS_ARCH(ptl0, i) ((pte_t *)((((pte_t *)(ptl0))[(i)].frame_address)<<12))
#define GET_PTL1_ADDRESS_ARCH(ptl0, i) ((pte_t *)((((pte_t *)(ptl0))[(i)].frame_address) << 12))
#define GET_PTL2_ADDRESS_ARCH(ptl1, i) (ptl1)
#define GET_PTL3_ADDRESS_ARCH(ptl2, i) (ptl2)
#define GET_FRAME_ADDRESS_ARCH(ptl3, i) ((uintptr_t)((((pte_t *)(ptl3))[(i)].frame_address)<<12))
#define GET_FRAME_ADDRESS_ARCH(ptl3, i) ((uintptr_t)((((pte_t *)(ptl3))[(i)].frame_address) << 12))
 
#define SET_PTL0_ADDRESS_ARCH(ptl0) (write_cr3((uintptr_t) (ptl0)))
#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) (((pte_t *)(ptl0))[(i)].frame_address = (a)>>12)
89,59 → 89,41
 
#define PTE_VALID_ARCH(p) (*((uint32_t *) (p)) != 0)
#define PTE_PRESENT_ARCH(p) ((p)->present != 0)
#define PTE_GET_FRAME_ARCH(p) ((p)->frame_address<<FRAME_WIDTH)
#define PTE_GET_FRAME_ARCH(p) ((p)->frame_address << FRAME_WIDTH)
#define PTE_WRITABLE_ARCH(p) ((p)->writeable != 0)
#define PTE_EXECUTABLE_ARCH(p) 1
 
#ifndef __ASM__
 
#include <mm/page.h>
#include <arch/types.h>
#include <arch/mm/frame.h>
#include <typedefs.h>
#include <mm/mm.h>
#include <arch/interrupt.h>
 
/* Page fault error codes. */
 
/** When bit on this position is 0, the page fault was caused by a not-present page. */
#define PFERR_CODE_P (1<<0)
#define PFERR_CODE_P (1 << 0)
 
/** When bit on this position is 1, the page fault was caused by a write. */
#define PFERR_CODE_RW (1<<1)
#define PFERR_CODE_RW (1 << 1)
 
/** When bit on this position is 1, the page fault was caused in user mode. */
#define PFERR_CODE_US (1<<2)
#define PFERR_CODE_US (1 << 2)
 
/** When bit on this position is 1, a reserved bit was set in page directory. */
#define PFERR_CODE_RSVD (1<<3)
#define PFERR_CODE_RSVD (1 << 3)
 
/** 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 pat : 1;
unsigned global : 1;
unsigned soft_valid : 1; /**< Valid content even if the present bit is not set. */
unsigned avl : 2;
unsigned frame_address : 20;
} __attribute__ ((packed));
 
static inline int get_pt_flags(pte_t *pt, index_t i)
{
pte_t *p = &pt[i];
return (
(!p->page_cache_disable)<<PAGE_CACHEABLE_SHIFT |
(!p->present)<<PAGE_PRESENT_SHIFT |
p->uaccessible<<PAGE_USER_SHIFT |
(!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT |
(!p->present) << PAGE_PRESENT_SHIFT |
p->uaccessible << PAGE_USER_SHIFT |
1<<PAGE_READ_SHIFT |
p->writeable<<PAGE_WRITE_SHIFT |
p->writeable << PAGE_WRITE_SHIFT |
1<<PAGE_EXEC_SHIFT |
p->global<<PAGE_GLOBAL_SHIFT
p->global << PAGE_GLOBAL_SHIFT
);
}
 
/trunk/kernel/arch/ia32/include/mm/asid.h
42,11 → 42,13
#ifndef KERN_ia32_ASID_H_
#define KERN_ia32_ASID_H_
 
typedef int asid_t;
#include <arch/types.h>
 
typedef int32_t asid_t;
 
#define ASID_MAX_ARCH 3
 
#define asid_get() (ASID_START+1)
#define asid_get() (ASID_START + 1)
#define asid_put(asid)
 
#endif
/trunk/kernel/arch/ia32/include/mm/as.h
47,6 → 47,8
typedef struct {
} as_arch_t;
 
#include <genarch/mm/as_pt.h>
 
#define as_constructor_arch(as, flags) (as != as)
#define as_destructor_arch(as) (as != as)
#define as_create_arch(as, flags) (as != as)
/trunk/kernel/arch/ia32/include/cpu.h
35,7 → 35,6
#ifndef KERN_ia32_CPU_H_
#define KERN_ia32_CPU_H_
 
#include <typedefs.h>
#include <arch/pm.h>
#include <arch/asm.h>
 
/trunk/kernel/arch/ia32/src/ia32.c
35,7 → 35,6
#include <arch.h>
 
#include <arch/types.h>
#include <typedefs.h>
 
#include <arch/pm.h>
 
/trunk/kernel/arch/ia32/src/cpu/cpu.c
39,7 → 39,6
#include <arch.h>
#include <arch/types.h>
#include <print.h>
#include <typedefs.h>
#include <fpu_context.h>
 
#include <arch/smp/apic.h>
/trunk/kernel/arch/ia32/src/pm.c
35,7 → 35,6
#include <arch/pm.h>
#include <config.h>
#include <arch/types.h>
#include <typedefs.h>
#include <arch/interrupt.h>
#include <arch/asm.h>
#include <arch/context.h>
/trunk/kernel/arch/ia32/src/smp/mps.c
42,7 → 42,6
#include <arch/smp/smp.h>
#include <func.h>
#include <arch/types.h>
#include <typedefs.h>
#include <cpu.h>
#include <arch/asm.h>
#include <arch/bios/bios.h>
/trunk/kernel/arch/ia32/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/ia32/src/boot/boot.S
74,7 → 74,7
rep movsb
 
mov $VESA_INIT_SEGMENT << 4, %edi
jmpl %edi
jmpl *%edi
vesa_meeting_point:
/trunk/kernel/arch/ia32/src/mm/as.c
34,7 → 34,7
*/
 
#include <arch/mm/as.h>
#include <genarch/mm/as_pt.h>
#include <genarch/mm/page_pt.h>
 
/** Architecture dependent address space init. */
void as_arch_init(void)
/trunk/kernel/arch/ia32/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)
/trunk/kernel/arch/ia32/src/drivers/vesa.c
47,7 → 47,6
#include <synch/spinlock.h>
#include <arch/asm.h>
#include <arch/types.h>
#include <typedefs.h>
#include <memstr.h>
#include <bitops.h>