Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccf3fe02 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by H. Peter Anvin
Browse files

x86-32: use brk segment for allocating initial kernel pagetable



Impact: use new interface instead of previous ad hoc implementation

Rather than having special purpose init_pg_table_start/end variables
to delimit the kernel pagetable built by head_32.S, just use the brk
mechanism to extend the bss for the new pagetable.

This patch removes init_pg_table_start/end and pg0, defines __brk_base
(which is page-aligned and immediately follows _end), initializes
the brk region to start there, and uses it for the 32-bit pagetable.

Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
parent 5368a2be
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -42,9 +42,6 @@ extern void set_pmd_pfn(unsigned long, unsigned long, pgprot_t);
 */
 */
#undef TEST_ACCESS_OK
#undef TEST_ACCESS_OK


/* The boot page tables (all created as a single array) */
extern unsigned long pg0[];

#ifdef CONFIG_X86_PAE
#ifdef CONFIG_X86_PAE
# include <asm/pgtable-3level.h>
# include <asm/pgtable-3level.h>
#else
#else
+0 −3
Original line number Original line Diff line number Diff line
@@ -109,9 +109,6 @@ void *extend_brk(size_t size, size_t align);
void __init i386_start_kernel(void);
void __init i386_start_kernel(void);
extern void probe_roms(void);
extern void probe_roms(void);


extern unsigned long init_pg_tables_start;
extern unsigned long init_pg_tables_end;

#else
#else
void __init x86_64_start_kernel(char *real_mode);
void __init x86_64_start_kernel(char *real_mode);
void __init x86_64_start_reservations(char *real_mode_data);
void __init x86_64_start_reservations(char *real_mode_data);
+0 −3
Original line number Original line Diff line number Diff line
@@ -29,9 +29,6 @@ void __init i386_start_kernel(void)
		reserve_early(ramdisk_image, ramdisk_end, "RAMDISK");
		reserve_early(ramdisk_image, ramdisk_end, "RAMDISK");
	}
	}
#endif
#endif
	reserve_early(init_pg_tables_start, init_pg_tables_end,
			"INIT_PG_TABLE");

	reserve_ebda_region();
	reserve_ebda_region();


	/*
	/*
+7 −7
Original line number Original line Diff line number Diff line
@@ -167,7 +167,7 @@ num_subarch_entries = (. - subarch_entries) / 4
/*
/*
 * Initialize page tables.  This creates a PDE and a set of page
 * Initialize page tables.  This creates a PDE and a set of page
 * tables, which are located immediately beyond _end.  The variable
 * tables, which are located immediately beyond _end.  The variable
 * init_pg_tables_end is set up to point to the first "safe" location.
 * _brk_end is set up to point to the first "safe" location.
 * Mappings are created both at virtual address 0 (identity mapping)
 * Mappings are created both at virtual address 0 (identity mapping)
 * and PAGE_OFFSET for up to _end+sizeof(page tables)+INIT_MAP_BEYOND_END.
 * and PAGE_OFFSET for up to _end+sizeof(page tables)+INIT_MAP_BEYOND_END.
 *
 *
@@ -190,8 +190,7 @@ default_entry:


	xorl %ebx,%ebx				/* %ebx is kept at zero */
	xorl %ebx,%ebx				/* %ebx is kept at zero */


	movl $pa(pg0), %edi
	movl $pa(__brk_base), %edi
	movl %edi, pa(init_pg_tables_start)
	movl $pa(swapper_pg_pmd), %edx
	movl $pa(swapper_pg_pmd), %edx
	movl $PTE_IDENT_ATTR, %eax
	movl $PTE_IDENT_ATTR, %eax
10:
10:
@@ -216,7 +215,8 @@ default_entry:
	cmpl %ebp,%eax
	cmpl %ebp,%eax
	jb 10b
	jb 10b
1:
1:
	movl %edi,pa(init_pg_tables_end)
	addl $__PAGE_OFFSET, %edi
	movl %edi, pa(_brk_end)
	shrl $12, %eax
	shrl $12, %eax
	movl %eax, pa(max_pfn_mapped)
	movl %eax, pa(max_pfn_mapped)


@@ -227,8 +227,7 @@ default_entry:


page_pde_offset = (__PAGE_OFFSET >> 20);
page_pde_offset = (__PAGE_OFFSET >> 20);


	movl $pa(pg0), %edi
	movl $pa(__brk_base), %edi
	movl %edi, pa(init_pg_tables_start)
	movl $pa(swapper_pg_dir), %edx
	movl $pa(swapper_pg_dir), %edx
	movl $PTE_IDENT_ATTR, %eax
	movl $PTE_IDENT_ATTR, %eax
10:
10:
@@ -249,7 +248,8 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
	leal (INIT_MAP_BEYOND_END+PTE_IDENT_ATTR)(%edi),%ebp
	leal (INIT_MAP_BEYOND_END+PTE_IDENT_ATTR)(%edi),%ebp
	cmpl %ebp,%eax
	cmpl %ebp,%eax
	jb 10b
	jb 10b
	movl %edi,pa(init_pg_tables_end)
	addl $__PAGE_OFFSET, %edi
	movl %edi, pa(_brk_end)
	shrl $12, %eax
	shrl $12, %eax
	movl %eax, pa(max_pfn_mapped)
	movl %eax, pa(max_pfn_mapped)


+0 −6
Original line number Original line Diff line number Diff line
@@ -161,12 +161,6 @@ static struct resource bss_resource = {




#ifdef CONFIG_X86_32
#ifdef CONFIG_X86_32
/* This value is set up by the early boot code to point to the value
   immediately after the boot time page tables.  It contains a *physical*
   address, and must not be in the .bss segment! */
unsigned long init_pg_tables_start __initdata = ~0UL;
unsigned long init_pg_tables_end __initdata = ~0UL;

static struct resource video_ram_resource = {
static struct resource video_ram_resource = {
	.name	= "Video RAM area",
	.name	= "Video RAM area",
	.start	= 0xa0000,
	.start	= 0xa0000,
Loading