7 * Copyright (c) 2010, ETH Zurich.
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
15 #ifndef OFFSETS_ARCH_H
16 #define OFFSETS_ARCH_H
18 #include <target/k1om/offsets_target.h>
20 #define PADDR_SPACE_SIZE X86_64_PADDR_SPACE_SIZE
21 #define PADDR_SPACE_LIMIT X86_64_PADDR_SPACE_LIMIT
23 #define REAL_MODE_LINEAR_OFFSET X86_64_REAL_MODE_LINEAR_OFFSET
24 #define REAL_MODE_SEGMENT X86_64_REAL_MODE_SEGMENT
25 #define REAL_MODE_OFFSET X86_64_REAL_MODE_OFFSET
27 #define REAL_MODE_SEGMENT_TO_REAL_MODE_PAGE(seg) X86_64_REAL_MODE_SEGMENT_TO_REAL_MODE_PAGE(seg)
28 #define REAL_MODE_ADDR_TO_REAL_MODE_VECTOR(seg,off) X86_64_REAL_MODE_ADDR_TO_REAL_MODE_VECTOR(seg,off)
33 * Takes absolute physical address addr and returns corresponding
34 * "physical memory address space" address.
36 * \param addr Absolute physical address
38 * \return Corresponding "physical memory address space" address.
40 static inline lvaddr_t local_phys_to_mem(lpaddr_t addr)
42 assert(addr < X86_64_PADDR_SPACE_LIMIT);
43 return (lvaddr_t)(addr + (lvaddr_t)X86_64_MEMORY_OFFSET);
47 * Takes "physical memory address space" address and returns
48 * corresponding physical address.
50 * \param addr Absolute physical address
52 * \return Corresponding "physical memory address space" address.
54 static inline lpaddr_t mem_to_local_phys(lvaddr_t addr)
56 assert(addr >= X86_64_MEMORY_OFFSET);
57 return (lpaddr_t)(addr - (lpaddr_t)X86_64_MEMORY_OFFSET);
60 static inline lpaddr_t gen_phys_to_local_phys(genpaddr_t addr)
62 return (lpaddr_t)addr;
65 static inline genpaddr_t local_phys_to_gen_phys(lpaddr_t addr)
67 return (genpaddr_t)addr;
71 * Symbol: Start of kernel image. This symbol points to the start
72 * address of the kernel image.
74 extern char _start_kernel;
77 * Symbol: End of kernel image. This symbol points to the end address
78 * of the kernel image.
80 extern char _end_kernel;
83 * The size of the whole kernel image.
85 #define SIZE_KERNEL_IMAGE \
86 (size_t)(&_end_kernel - &_start_kernel)
88 #endif // __ASSEMBLER__
90 #endif // OFFSETS_ARCH_H