More changes for cleaner initialization and support for containers.

This commit is contained in:
Bahadir Balban
2009-07-25 17:44:29 +03:00
parent ba1cc0c6bc
commit f7b768ee16
17 changed files with 247 additions and 149 deletions

View File

@@ -16,14 +16,10 @@ extern unsigned long arm_high_vector[];
extern unsigned long _end_vectors[];
extern unsigned long _start_kip[];
extern unsigned long _end_kip[];
extern unsigned long _start_ptab[];
extern unsigned long _end_ptab[];
extern unsigned long _start_init[];
extern unsigned long _end_init[];
extern unsigned long _bootstack[];
extern unsigned long _end_kernel[];
extern unsigned long _start_kspace[];
extern unsigned long _start_pmd[];
extern unsigned long _end_pmd[];
extern unsigned long _end_kspace[];
extern unsigned long _end[];
/* Link markers that get modified at runtime */

View File

@@ -1,36 +1,32 @@
/*
*
* Simple linker script
*
* Copyright (C) 2007 Bahadir Balban
*
*/
/* FIXME:
* Currently we can't include cpp #defines in linker script.
* Check that below offsets are coherent with offsets.h
*/
phys_addr_base = 0x100000;
kern_offset = 0xF0000000;
virt_addr_base = phys_addr_base + kern_offset;
kernel_offset = 0xF0000000;
kernel_physical = 0x8000;
kernel_virtual = kernel_physical + kernel_offset;
/* A temporary boot stack is used before a proper kernel stack is set up */
_bootstack_physical = _bootstack - kern_offset;
_bootstack_physical = _bootstack - kernel_offset;
/* The symbols are linked at virtual addresses. So is _start.
* We must set the entry point to a physical address, so that
* when the image is loaded, it doesn't jump to a non existing
* virtual address.
*/
_start_physical = phys_addr_base;
ENTRY(_start_physical)
ENTRY(kernel_physical)
SECTIONS
{
. = virt_addr_base;
. = kernel_virtual;
_start_kernel = .;
.text : AT (ADDR(.text) - kern_offset)
.text : AT (ADDR(.text) - kernel_offset)
{
_start_text = .;
/* Make sure head.S comes first */
@@ -41,9 +37,9 @@ SECTIONS
}
. = ALIGN(4);
/* rodata is needed else your strings will link at physical! */
.rodata : AT (ADDR(.rodata) - kern_offset) { *(.rodata) }
.rodata1 : AT (ADDR(.rodata1) - kern_offset) { *(.rodata1) }
.data : AT (ADDR(.data) - kern_offset)
.rodata : AT (ADDR(.rodata) - kernel_offset) { *(.rodata) }
.rodata1 : AT (ADDR(.rodata1) - kernel_offset) { *(.rodata1) }
.data : AT (ADDR(.data) - kernel_offset)
{
_start_data = .;
*(.data)
@@ -61,7 +57,7 @@ SECTIONS
_end_syscalls = .;
_end_data = .;
}
.bss : AT (ADDR(.bss) - kern_offset)
.bss : AT (ADDR(.bss) - kernel_offset)
{
*(.bss)
}
@@ -69,19 +65,20 @@ SECTIONS
. += 0x2000; /* This is required as the link counter does not seem
* to increment for the bss section
* TODO: Change this with PAGE_SIZE */
/* Below part is to be discarded after boot */
_start_init = .;
.init : AT (ADDR(.init) - kernel_offset)
{
. = ALIGN(16K); /* For initial pgd */
*(.init.pgd)
*(.init.data)
*(.init.bootmem)
}
/* Space for boot stack */
. += 0x1000;
_end_init = .;
_bootstack = .;
_end_kernel = .;
. = ALIGN(1M);
.kspace : AT(ADDR(.kspace) - kern_offset)
{
_start_kspace = .;
*(.kspace.pgd)
. = ALIGN(4K);
_start_pmd = .;
*(.kspace.pmd)
_end_pmd = .;
_end_kspace = .;
}
_end = .;
}

View File

@@ -137,6 +137,9 @@ void arch_hardware_flush(pgd_table_t *pgd);
void add_section_mapping_init(unsigned int paddr, unsigned int vaddr,
unsigned int size, unsigned int flags);
void add_boot_mapping(unsigned int paddr, unsigned int vaddr,
unsigned int size, unsigned int flags);
struct address_space;
int delete_page_tables(struct address_space *space);
int copy_user_tables(struct address_space *new, struct address_space *orig);

View File

@@ -0,0 +1,13 @@
/*
* Copyright (C) 2009 Bahadir Balban
*/
#ifndef __BOOTMEM_H__
#define __BOOTMEM_H__
void *alloc_bootmem(int size, int alignment);
pmd_table_t *alloc_boot_pmd(void);
extern pgd_table_t init_pgd;
#endif /* __BOOTMEM_H__ */

View File

@@ -33,7 +33,7 @@
#define page_align(addr) (((unsigned int)(addr)) & \
(~PAGE_MASK))
#define is_aligned(val, mask) (!(((unsigned long)(val)) & mask))
#define is_aligned(val, size) (!(((unsigned long)(val)) & ((size) - 1)))
#define is_page_aligned(val) (!(((unsigned long)(val)) & PAGE_MASK))
#define page_boundary(x) is_page_aligned(x)
@@ -80,13 +80,6 @@ static inline void be32_to_cpu(unsigned int x)
#define TASK_AVERAGE_SIZE SZ_16MB
#define TASKS_PER_1MB_GRANT 28
extern pgd_table_t kspace;
extern pmd_table_t pmd_tables[];
extern unsigned long pmdtab_i;
void init_pmd_tables(void);
pmd_table_t *alloc_boot_pmd(void);
/*
* Each time a pager grants memory to the kernel, these parameters are called
* for in order to distribute the granted memory for different purposes.
@@ -104,13 +97,9 @@ typedef struct grant_kmem_usage {
} grant_kmem_usage_t;
void paging_init(void);
void init_pmd_tables(void);
void init_clear_ptab(void);
unsigned int space_flags_to_ptflags(unsigned int flags);
void add_boot_mapping(unsigned int paddr, unsigned int vaddr,
unsigned int size, unsigned int flags);
void add_mapping_pgd(unsigned int paddr, unsigned int vaddr,
unsigned int size, unsigned int flags,
pgd_table_t *pgd);

View File

@@ -33,7 +33,7 @@
#define PB926_SIC_BASE 0x10003000 /* Secondary IC */
#define PB926_UART0_BASE 0x101F1000 /* Console port (UART0) */
/*
/*
* Uart virtual address until a file-based console access
* is available for userspace
*/