Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 193 → Rev 194

/SPARTAN/trunk/arch/amd64/include/interrupt.h
26,8 → 26,8
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifndef __INTERRUPT_H__
#define __INTERRUPT_H__
#ifndef __amd64_INTERRUPT_H__
#define __amd64_INTERRUPT_H__
 
extern void interrupt(void);
 
/SPARTAN/trunk/arch/amd64/include/pm.h
26,12 → 26,14
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifndef __PM_H__
#define __PM_H__
#ifndef __amd64_PM_H__
#define __amd64_PM_H__
 
#include <arch/types.h>
#include <typedefs.h>
#include <arch/context.h>
#ifndef __ASM__
# include <arch/types.h>
# include <typedefs.h>
# include <arch/context.h>
#endif
 
#define IDT_ITEMS 64
#define GDT_ITEMS 7
41,7 → 43,8
#define KDATA_DES 2
#define UTEXT_DES 3
#define UDATA_DES 4
#define TSS_DES 5
#define KTEXT32_DES 5
#define TSS_DES 6
 
#define selector(des) ((des)<<3)
 
61,6 → 64,8
 
#define IO_MAP_BASE (104)
 
#ifndef __ASM__
 
struct ptr_16_32 {
__u16 limit;
__u32 base;
145,4 → 150,6
 
extern void tss_initialize(struct tss *t);
 
#endif /* __ASM__ */
 
#endif
/SPARTAN/trunk/arch/amd64/include/boot/memmap.h
26,8 → 26,8
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifndef __ia32_MEMMAP_H__
#define __ia32_MEMMAP_H__
#ifndef __amd64_MEMMAP_H__
#define __amd64_MEMMAP_H__
 
 
#include <arch/boot/memmapasm.h>
/SPARTAN/trunk/arch/amd64/include/boot/memmapasm.h
26,8 → 26,8
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifndef __ia32_MEMMAPASM_H__
#define __ia32_MEMMAPASM_H__
#ifndef __amd64_MEMMAPASM_H__
#define __amd64_MEMMAPASM_H__
 
 
/* E820h memory range types - other values*/
/SPARTAN/trunk/arch/amd64/include/mm/frame.h
31,6 → 31,8
 
#define FRAME_SIZE 4096
 
#ifndef __ASM__
extern void frame_arch_init(void);
#endif
 
#endif
/SPARTAN/trunk/arch/amd64/include/mm/page.h
29,13 → 29,22
#ifndef __amd64_PAGE_H__
#define __amd64_PAGE_H__
 
#include <mm/page.h>
#include <arch/mm/frame.h>
#include <arch/types.h>
#include <arch/mm/ptl.h>
#ifndef __ASM__
# include <mm/page.h>
# include <arch/mm/frame.h>
# include <arch/types.h>
#endif
 
#define PAGE_SIZE FRAME_SIZE
 
#ifndef __ASM__
# define KA2PA(x) (((__address) (x)) + 0x80000000)
# define PA2KA(x) (((__address) (x)) - 0x80000000)
#else
# define KA2PA(x) ((x) + 0x80000000)
# define PA2KA(x) ((x)) - 0x80000000)
#endif
 
#define PTL0_INDEX_ARCH(vaddr) 0
#define PTL1_INDEX_ARCH(vaddr) 0
#define PTL2_INDEX_ARCH(vaddr) 0
64,8 → 73,10
#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
#define SET_FRAME_FLAGS_ARCH(ptl3, i, x)
 
#ifndef __ASM__
extern void page_arch_init(void);
 
typedef __u32 pte_t;
typedef __u64 pte_t;
#endif
 
#endif
/SPARTAN/trunk/arch/amd64/include/mm/ptl.h
39,8 → 39,5
#define PTL_PRESENT 1
#define PTL_2MB_PAGE (1<<7)
 
#define KA2PA(x) (((__address) (x)) + 0x80000000)
#define PA2KA(x) (((__address) (x)) - 0x80000000)
 
 
#endif
/SPARTAN/trunk/arch/amd64/include/barrier.h
26,8 → 26,8
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifndef __ppc_BARRIER_H__
#define __ppc_BARRIER_H__
#ifndef __amd64_BARRIER_H__
#define __amd64_BARRIER_H__
 
#define CS_ENTER_BARRIER() __asm__ volatile ("" ::: "memory")
#define CS_LEAVE_BARRIER() __asm__ volatile ("" ::: "memory")
/SPARTAN/trunk/arch/amd64/src/boot/boot.S
1,5 → 1,5
#
# Copyright (C) 2001-2004 Jakub Jermar
# Copyright (C) 2001-2004 Ondrej Palkovsky
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
26,7 → 26,11
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
 
#define __ASM__
 
#include <arch/mm/page.h>
#include <arch/mm/ptl.h>
#include <arch/pm.h>
 
#define START_STACK 0x7c00
#define START_STACK_64 $0xffffffff80007c00
51,11 → 55,11
# call memmap_arch_init
mov $0x80000000, %eax
movl $0x80000000, %eax
cpuid
cmp $0x80000000, %eax # any function > 80000000h?
jbe no_long_mode
mov $0x80000001, %eax # Extended function code 80000001
movl $0x80000001, %eax # Extended function code 80000001
cpuid
bt $29, %edx # Test if long mode is supported.
jnc no_long_mode
68,7 → 72,7
orl $0x1,%eax
movl %eax,%cr0 # switch to protected mode
 
jmpl $40, $now_in_prot
jmpl $selector(KTEXT32_DES), $now_in_prot
 
no_long_mode:
1:
78,7 → 82,7
# the Default operand size must not be 1 when entering long mode
now_in_prot:
# Set up stack & data descriptors
movw $16, %ax
movw $selector(KDATA_DES), %ax
movw %ax, %ds
movw %ax, %fs
movw %ax, %gs
106,7 → 110,7
movl %eax, %cr0
# At this point we are in compatibility mode
jmpl $8, $start64
jmpl $selector(KTEXT_DES), $start64
 
.code64
start64:
149,10 → 153,10
 
.global gdtr_inst
gdtr_inst:
.word 7*8 # GDT_ITEMS * 8
.long gdt + 0x80000000
.word selector(GDT_ITEMS)
.long KA2PA(gdt)
 
.global idtr_inst
idtr_inst:
.word 0
.long idt + 0x80000000
.long KA2PA(idt)
/SPARTAN/trunk/arch/amd64/_link.ld
40,5 → 40,4
_hardcoded_ktext_size = ktext_end - ktext_start + (unmapped_ktext_end - unmapped_ktext_start);
_hardcoded_kdata_size = kdata_end - kdata_start + (unmapped_kdata_end - unmapped_kdata_start);
_hardcoded_load_address = 0xffffffff80008000;
_ka_start = 0xffffffff80000000;
}