Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 75 → Rev 76

/SPARTAN/trunk/src/main/main.c
53,6 → 53,7
#include <synch/waitq.h>
 
#include <arch.h>
#include <arch/faddr.h>
 
char *project = "SPARTAN kernel";
char *copyright = "Copyright (C) 2001-2005 Jakub Jermar, Copyright (C) 2005 HelenOS project";
94,7 → 95,7
 
context_save(&ctx);
ctx.sp = config.base + config.kernel_size - 8;
ctx.pc = (__address) main_bsp_separated_stack;
ctx.pc = FADDR(main_bsp_separated_stack);
context_restore(&ctx);
/* not reached */
}
192,7 → 193,7
* switch to this cpu's private stack prior to waking kmp up.
*/
CPU->saved_context.sp = (__address) &CPU->stack[CPU_STACK_SIZE-8];
CPU->saved_context.pc = (__address) main_ap_separated_stack;
CPU->saved_context.pc = FADDR(main_ap_separated_stack);
context_restore(&CPU->saved_context);
/* not reached */
}
/SPARTAN/trunk/src/proc/scheduler.c
41,6 → 41,7
#include <typedefs.h>
#include <mm/page.h>
#include <synch/spinlock.h>
#include <arch/faddr.h>
 
#ifdef __SMP__
#include <arch/smp/atomic.h>
232,7 → 233,7
*/
context_save(&CPU->saved_context);
CPU->saved_context.sp = (__address) &CPU->stack[CPU_STACK_SIZE-8];
CPU->saved_context.pc = (__address) scheduler_separated_stack;
CPU->saved_context.pc = FADDR(scheduler_separated_stack);
context_restore(&CPU->saved_context);
/* not reached */
}
/SPARTAN/trunk/src/proc/thread.c
48,6 → 48,7
#include <config.h>
#include <arch/interrupt.h>
#include <smp/ipi.h>
#include <arch/faddr.h>
 
char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"};
 
164,7 → 165,7
context_save(&t->saved_context);
t->saved_context.pc = (__address) cushion;
t->saved_context.pc = FADDR(cushion);
t->saved_context.sp = (__address) &t->kstack[THREAD_STACK_SIZE-8];
 
pri = cpu_priority_high();
/SPARTAN/trunk/src/Makefile
76,7 → 76,7
$(CC) $(CPPFLAGS) -E $< >$@
 
%.o: %.s
$(AS) $< -o $@
$(AS) $(ASFLAGS) $< -o $@
 
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
/SPARTAN/trunk/arch/ia64/include/faddr.h
0,0 → 1,56
/*
* Copyright (C) 2005 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifndef __ia64_FADDR_H__
#define __ia64_FADDR_H__
 
#include <arch/types.h>
 
static __address FADDR(void (* fptr)(void));
 
/**
*
* Calculate absolute address of function
* referenced by fptr pointer.
*
* @param fptr Function pointer.
*
*/
inline __address FADDR(void (* fptr)(void)) {
__address faddr;
__asm__(
"ld8 %0 = [%1]\n\t"
: "=r" (faddr)
: "r" (fptr)
);
return faddr;
}
 
#endif
/SPARTAN/trunk/arch/ia64/Makefile.inc
7,12 → 7,12
AS=$(IA-64_BINUTILS_DIR)/$(IA-64_TARGET)-as
LD=$(IA-64_BINUTILS_DIR)/$(IA-64_TARGET)-ld
 
ASFLAGS=-EL
ASFLAGS=-mconstant-gp
 
DEFS=-DARCH=$(ARCH)
CPPFLAGS=$(DEFS) -nostdinc -I../include
CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -Wmissing-prototypes -Werror -O3
LFLAGS=-EL -M -no-check-sections -T ../arch/ia64/_link.ld
CFLAGS=$(CPPFLAGS) -mconstant-gp -nostdlib -fno-builtin -Wmissing-prototypes -Werror -O3
LFLAGS=-EL -M -T ../arch/ia64/_link.ld
 
arch_sources= \
arch/start.S \
22,5 → 22,3
arch/ia64.c \
arch/fpu_context.c \
arch/context.S
 
/SPARTAN/trunk/arch/mips/include/faddr.h
0,0 → 1,36
/*
* Copyright (C) 2005 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifndef __mips_FADDR_H__
#define __mips_FADDR_H__
 
#include <arch/types.h>
 
#define FADDR(fptr) ((__address) (fptr))
 
#endif
/SPARTAN/trunk/arch/ia32/include/faddr.h
0,0 → 1,36
/*
* Copyright (C) 2005 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifndef __ia32_FADDR_H__
#define __ia32_FADDR_H__
 
#include <arch/types.h>
 
#define FADDR(fptr) ((__address) (fptr))
 
#endif