aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/arch
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-01-17 14:41:44 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-01-17 14:41:44 +0000
commit22e39d084eaa3b058ec34964156511fe963ce4d4 (patch)
tree0566e56ab0131abd998692127a2deea8d845a17d /extras/mini-os/arch
parente2edfe6c73a287989911630a070c3e6c1137446f (diff)
downloadxen-22e39d084eaa3b058ec34964156511fe963ce4d4.tar.gz
xen-22e39d084eaa3b058ec34964156511fe963ce4d4.tar.bz2
xen-22e39d084eaa3b058ec34964156511fe963ce4d4.zip
minios: make stack size configurable
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com> Signed-off-by: Grzegorz Milos <gm281@cam.ac.uk>
Diffstat (limited to 'extras/mini-os/arch')
-rw-r--r--extras/mini-os/arch/ia64/sched.c6
-rw-r--r--extras/mini-os/arch/x86/sched.c8
-rw-r--r--extras/mini-os/arch/x86/setup.c4
-rw-r--r--extras/mini-os/arch/x86/x86_32.S5
-rw-r--r--extras/mini-os/arch/x86/x86_64.S5
5 files changed, 15 insertions, 13 deletions
diff --git a/extras/mini-os/arch/ia64/sched.c b/extras/mini-os/arch/ia64/sched.c
index 64052b6fc5..bf1095686a 100644
--- a/extras/mini-os/arch/ia64/sched.c
+++ b/extras/mini-os/arch/ia64/sched.c
@@ -40,11 +40,11 @@ arch_create_thread(char *name, void (*function)(void *), void *data)
struct thread* _thread;
_thread = (struct thread*)_xmalloc(sizeof(struct thread), 16);
- /* Allocate 2 pages for stack, stack will be 2pages aligned */
- _thread->stack = (char *)alloc_pages(1);
+ /* Allocate pages for stack, stack will be aligned */
+ _thread->stack = (char *)alloc_pages(STACK_SIZE_PAGE_ORDER);
_thread->name = name;
memset((void*)&(_thread->regs), 0, sizeof(_thread->regs));
- _thread->regs.sp = ((uint64_t)_thread->stack) + 2 * PAGE_SIZE - 16;
+ _thread->regs.sp = ((uint64_t)_thread->stack) + STACK_SIZE - 16;
_thread->regs.bsp = ((uint64_t)_thread->stack) + 0x10;
_thread->regs.rp = FDESC_FUNC(thread_starter);
_thread->regs.pfs = 0x82;
diff --git a/extras/mini-os/arch/x86/sched.c b/extras/mini-os/arch/x86/sched.c
index 204980a564..9b98b93a55 100644
--- a/extras/mini-os/arch/x86/sched.c
+++ b/extras/mini-os/arch/x86/sched.c
@@ -57,7 +57,7 @@
void dump_stack(struct thread *thread)
{
- unsigned long *bottom = (unsigned long *)(thread->stack + 2*4*1024);
+ unsigned long *bottom = (unsigned long *)(thread->stack + STACK_SIZE);
unsigned long *pointer = (unsigned long *)thread->sp;
int count;
if(thread == current)
@@ -98,13 +98,13 @@ struct thread* arch_create_thread(char *name, void (*function)(void *),
struct thread *thread;
thread = xmalloc(struct thread);
- /* Allocate 2 pages for stack, stack will be 2pages aligned */
- thread->stack = (char *)alloc_pages(1);
+ /* We can't use lazy allocation here since the trap handler runs on the stack */
+ thread->stack = (char *)alloc_pages(STACK_SIZE_PAGE_ORDER);
thread->name = name;
printk("Thread \"%s\": pointer: 0x%lx, stack: 0x%lx\n", name, thread,
thread->stack);
- thread->sp = (unsigned long)thread->stack + 4096 * 2;
+ thread->sp = (unsigned long)thread->stack + STACK_SIZE;
/* Save pointer to the thread on the stack, used by current macro */
*((unsigned long *)thread->stack) = (unsigned long)thread;
diff --git a/extras/mini-os/arch/x86/setup.c b/extras/mini-os/arch/x86/setup.c
index 8106941140..066c87f5b7 100644
--- a/extras/mini-os/arch/x86/setup.c
+++ b/extras/mini-os/arch/x86/setup.c
@@ -45,7 +45,7 @@ union start_info_union start_info_union;
* Just allocate the kernel stack here. SS:ESP is set up to point here
* in head.S.
*/
-char stack[2*8192];
+char stack[2*STACK_SIZE];
extern char shared_info[PAGE_SIZE];
@@ -102,7 +102,7 @@ arch_init(start_info_t *si)
void
arch_print_info(void)
{
- printk(" stack: %p-%p\n", stack, stack + 2*8192);
+ printk(" stack: %p-%p\n", stack, stack + sizeof(stack));
}
diff --git a/extras/mini-os/arch/x86/x86_32.S b/extras/mini-os/arch/x86/x86_32.S
index 09ffeda9ba..4b9a337c08 100644
--- a/extras/mini-os/arch/x86/x86_32.S
+++ b/extras/mini-os/arch/x86/x86_32.S
@@ -1,4 +1,5 @@
#include <os.h>
+#include <arch_mm.h>
#include <xen/arch-x86_32.h>
.section __xen_guest
@@ -21,12 +22,12 @@
_start:
cld
lss stack_start,%esp
- andl $(~(8192-1)), %esp
+ andl $(~(STACK_SIZE-1)), %esp
push %esi
call start_kernel
stack_start:
- .long stack+(2*8192), __KERNEL_SS
+ .long stack+(2*STACK_SIZE), __KERNEL_SS
/* Unpleasant -- the PTE that maps this page is actually overwritten */
/* to map the real shared-info page! :-) */
diff --git a/extras/mini-os/arch/x86/x86_64.S b/extras/mini-os/arch/x86/x86_64.S
index 815dca36ad..fae2ae4cf5 100644
--- a/extras/mini-os/arch/x86/x86_64.S
+++ b/extras/mini-os/arch/x86/x86_64.S
@@ -1,4 +1,5 @@
#include <os.h>
+#include <arch_mm.h>
#include <xen/features.h>
.section __xen_guest
@@ -18,12 +19,12 @@
_start:
cld
movq stack_start(%rip),%rsp
- andq $(~(8192-1)), %rsp
+ andq $(~(STACK_SIZE-1)), %rsp
movq %rsi,%rdi
call start_kernel
stack_start:
- .quad stack+(2*8192)
+ .quad stack+(2*STACK_SIZE)
/* Unpleasant -- the PTE that maps this page is actually overwritten */
/* to map the real shared-info page! :-) */