Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 138771
b: refs/heads/master
c: 796216a
h: refs/heads/master
i:
  138769: 57f88da
  138767: df55019
v: v3
  • Loading branch information
Jeremy Fitzhardinge authored and H. Peter Anvin committed Mar 15, 2009
1 parent beed272 commit 94bfe7c
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7543c1de84ed93c6769c9f20dced08a522af8912
refs/heads/master: 796216a57fe45c04adc35bda1f0782efec78a713
30 changes: 30 additions & 0 deletions trunk/arch/x86/include/asm/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,29 @@ extern struct boot_params boot_params;
extern unsigned long _brk_end;
void *extend_brk(size_t size, size_t align);

/*
* Reserve space in the brk section. The name must be unique within
* the file, and somewhat descriptive. The size is in bytes. Must be
* used at file scope.
*
* (This uses a temp function to wrap the asm so we can pass it the
* size parameter; otherwise we wouldn't be able to. We can't use a
* "section" attribute on a normal variable because it always ends up
* being @progbits, which ends up allocating space in the vmlinux
* executable.)
*/
#define RESERVE_BRK(name,sz) \
static void __section(.discard) __used \
__brk_reservation_fn_##name##__(void) { \
asm volatile ( \
".pushsection .brk_reservation,\"aw\",@nobits;" \
"__brk_reservation_" #name "__:" \
" 1:.skip %c0;" \
" .size __brk_reservation_" #name "__, . - 1b;" \
" .popsection" \
: : "i" (sz)); \
}

#ifdef __i386__

void __init i386_start_kernel(void);
Expand All @@ -115,6 +138,13 @@ void __init x86_64_start_reservations(char *real_mode_data);

#endif /* __i386__ */
#endif /* _SETUP */
#else
#define RESERVE_BRK(name,sz) \
.pushsection .brk_reservation,"aw",@nobits; \
__brk_reservation_##name##__: \
1: .skip sz; \
.size __brk_reservation_##name##__,.-1b; \
.popsection
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */

Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/x86/kernel/head_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ ALLOCATOR_SLOP = 4

INIT_MAP_BEYOND_END = BOOTBITMAP_SIZE + (PAGE_TABLE_SIZE + ALLOCATOR_SLOP)*PAGE_SIZE_asm

RESERVE_BRK(pagetables, PAGE_TABLE_SIZE * PAGE_SIZE)

/*
* 32-bit kernel entrypoint; only used by the boot CPU. On entry,
* %esi points to the real-mode code as a 32-bit pointer.
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/x86/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
#define ARCH_SETUP
#endif

RESERVE_BRK(dmi_alloc, 65536);

unsigned int boot_cpu_id __read_mostly;

static __initdata unsigned long _brk_start = (unsigned long)__brk_base;
Expand Down
4 changes: 3 additions & 1 deletion trunk/arch/x86/kernel/vmlinux_32.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ SECTIONS

. = ALIGN(PAGE_SIZE);
__brk_base = . ;
. += 1024 * 1024 ;
. += 64 * 1024 ; /* 64k slop space */
*(.brk_reservation) /* areas brk users have reserved */
__brk_limit = . ;

_end = . ;
Expand All @@ -201,6 +202,7 @@ SECTIONS
/* Sections to be discarded */
/DISCARD/ : {
*(.exitcall.exit)
*(.discard)
}

STABS_DEBUG
Expand Down
4 changes: 3 additions & 1 deletion trunk/arch/x86/kernel/vmlinux_64.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ SECTIONS

. = ALIGN(PAGE_SIZE);
__brk_base = . ;
. += 1024 * 1024 ;
. += 64 * 1024; /* 64k slop space */
*(.brk_reservation) /* areas brk users have reserved */
__brk_limit = . ;
}

Expand All @@ -260,6 +261,7 @@ SECTIONS
/DISCARD/ : {
*(.exitcall.exit)
*(.eh_frame)
*(.discard)
}

STABS_DEBUG
Expand Down

0 comments on commit 94bfe7c

Please sign in to comment.