Commit e3b1acd4 authored by David Mosberger's avatar David Mosberger

ia64: Fix ia32 partial-page-list code to compile cleanly in more configs.

parent 74e4c2e8
......@@ -211,8 +211,6 @@ ia32_cpu_init (void)
static int __init
ia32_init (void)
{
extern kmem_cache_t *partial_page_cachep;
ia32_exec_domain.name = "Linux/x86";
ia32_exec_domain.handler = NULL;
ia32_exec_domain.pers_low = PER_LINUX32;
......@@ -221,11 +219,17 @@ ia32_init (void)
ia32_exec_domain.signal_invmap = default_exec_domain.signal_invmap;
register_exec_domain(&ia32_exec_domain);
#if PAGE_SHIFT > IA32_PAGE_SHIFT
{
extern kmem_cache_t *partial_page_cachep;
partial_page_cachep = kmem_cache_create("partial_page_cache",
sizeof(struct partial_page), 0, 0, NULL, NULL);
sizeof(struct partial_page), 0, 0,
NULL, NULL);
if (!partial_page_cachep)
panic("Cannot create partial page SLAB cache");
}
#endif
return 0;
}
......
#ifndef _ASM_IA64_IA32_H
#define _ASM_IA64_IA32_H
#ifndef _ASM_IA64_IA32_PRIV_H
#define _ASM_IA64_IA32_PRIV_H
#include <linux/config.h>
......@@ -17,7 +17,6 @@
* 32 bit structures for IA32 support.
*/
#define IA32_PAGE_SHIFT 12 /* 4KB pages */
#define IA32_PAGE_SIZE (1UL << IA32_PAGE_SHIFT)
#define IA32_PAGE_MASK (~(IA32_PAGE_SIZE - 1))
#define IA32_PAGE_ALIGN(addr) (((addr) + IA32_PAGE_SIZE - 1) & IA32_PAGE_MASK)
......@@ -45,7 +44,11 @@ struct partial_page_list {
atomic_t pp_count; /* reference count */
};
#if PAGE_SHIFT > IA32_PAGE_SHIFT
struct partial_page_list* ia32_init_pp_list (void);
#else
# define ia32_init_pp_list() 0
#endif
/* sigcontext.h */
/*
......@@ -553,4 +556,4 @@ extern int save_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_st
#endif /* !CONFIG_IA32_SUPPORT */
#endif /* _ASM_IA64_IA32_H */
#endif /* _ASM_IA64_IA32_PRIV_H */
......@@ -563,8 +563,10 @@ ia32_do_drop_pp_list(struct partial_page_list *ppl)
}
void
ia32_drop_partial_page_list(struct partial_page_list* ppl)
ia32_drop_partial_page_list(struct task_struct *task)
{
struct partial_page_list* ppl = task->thread.ppl;
if (ppl && atomic_dec_and_test(&ppl->pp_count))
ia32_do_drop_pp_list(ppl);
}
......@@ -855,14 +857,14 @@ sys32_mmap2 (unsigned int addr, unsigned int len, unsigned int prot, unsigned in
asmlinkage long
sys32_munmap (unsigned int start, unsigned int len)
{
unsigned int end, pstart, pend;
unsigned int end = start + len;
long ret;
end = start + len;
#if PAGE_SHIFT <= IA32_PAGE_SHIFT
ret = sys_munmap(start, end - start);
#else
unsigned int pstart, pend;
if (OFFSET4K(start))
return -EINVAL;
......@@ -1034,11 +1036,12 @@ sys32_mremap (unsigned int addr, unsigned int old_len, unsigned int new_len,
unsigned int flags, unsigned int new_addr)
{
long ret;
unsigned int old_end, new_end;
#if PAGE_SHIFT <= IA32_PAGE_SHIFT
ret = sys_mremap(addr, old_len, new_len, flags, new_addr);
#else
unsigned int old_end, new_end;
if (OFFSET4K(addr))
return -EINVAL;
......
......@@ -179,17 +179,19 @@ GLOBAL_ENTRY(ia64_switch_to)
.body
adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
movl r25=init_task
mov r27=IA64_KR(CURRENT_STACK)
adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
dep r20=0,in0,61,3 // physical address of "current"
;;
st8 [r22]=sp // save kernel stack pointer of old task
shr.u r26=r20,IA64_GRANULE_SHIFT
adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
cmp.eq p7,p6=r25,in0
;;
/*
* If we've already mapped this task's page, we can skip doing it again.
*/
cmp.eq p7,p6=r26,r27
(p6) cmp.eq p7,p6=r26,r27
(p6) br.cond.dpnt .map
;;
.done:
......
......@@ -154,6 +154,10 @@ start_ap:
#endif
;;
tpa r3=r2 // r3 == phys addr of task struct
;;
shr.u r16=r3,IA64_GRANULE_SHIFT
(isBP) br.cond.dpnt .load_current // BP stack is on region 5 --- no need to map it
// load mapping for stack (virtaddr in r2, physaddr in r3)
rsm psr.ic
movl r17=PAGE_KERNEL
......@@ -165,7 +169,6 @@ start_ap:
dep r2=-1,r3,61,3 // IMVA of task
;;
mov r17=rr[r2]
shr.u r16=r3,IA64_GRANULE_SHIFT
;;
dep r17=0,r17,8,24
;;
......@@ -180,6 +183,7 @@ start_ap:
srlz.d
;;
.load_current:
// load the "current" pointer (r13) and ar.k6 with the current task
mov IA64_KR(CURRENT)=r2 // virtual address
mov IA64_KR(CURRENT_STACK)=r16
......
......@@ -676,10 +676,8 @@ flush_thread (void)
/* drop floating-point and debug-register state if it exists: */
current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID);
ia64_drop_fpu(current);
#ifdef CONFIG_IA32_SUPPORT
if (IS_IA32_PROCESS(ia64_task_regs(current)))
ia32_drop_partial_page_list(current->thread.ppl);
#endif
ia32_drop_partial_page_list(current);
}
/*
......@@ -699,10 +697,8 @@ exit_thread (void)
if (current->thread.flags & IA64_THREAD_DBG_VALID)
pfm_release_debug_registers(current);
#endif
#ifdef CONFIG_IA32_SUPPORT
if (IS_IA32_PROCESS(ia64_task_regs(current)))
ia32_drop_partial_page_list(current->thread.ppl);
#endif
ia32_drop_partial_page_list(current);
}
unsigned long
......
......@@ -7,6 +7,7 @@
#include <asm/signal.h>
#define IA32_NR_syscalls 283 /* length of syscall table */
#define IA32_PAGE_SHIFT 12 /* 4KB pages */
#ifndef __ASSEMBLY__
......@@ -18,14 +19,19 @@ extern void ia32_gdt_init (void);
extern int ia32_exception (struct pt_regs *regs, unsigned long isr);
extern int ia32_intercept (struct pt_regs *regs, unsigned long isr);
extern int ia32_clone_tls (struct task_struct *child, struct pt_regs *childregs);
extern int ia32_copy_partial_page_list (struct task_struct *, unsigned long);
extern void ia32_drop_partial_page_list (struct partial_page_list *);
# endif /* !CONFIG_IA32_SUPPORT */
/* Declare this unconditionally, so we don't get warnings for unreachable code. */
extern int ia32_setup_frame1 (int sig, struct k_sigaction *ka, siginfo_t *info,
sigset_t *set, struct pt_regs *regs);
#if PAGE_SHIFT > IA32_PAGE_SHIFT
extern int ia32_copy_partial_page_list (struct task_struct *, unsigned long);
extern void ia32_drop_partial_page_list (struct task_struct *);
#else
# define ia32_copy_partial_page_list(a1, a2) 0
# define ia32_drop_partial_page_list(a1) do { ; } while (0)
#endif
#endif /* !__ASSEMBLY__ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment