Commit 7cf73995 authored by He Chuyue's avatar He Chuyue Committed by guzitao
Browse files

sw64: fix THREAD_INFO_IN_TASK support

Sunway inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6ILGG



--------------------------------

Since CONFIG_THREAD_INFO_IN_TASK has been activated, init_thread_info
and __current_thread_info are removed, and compile errors occur if
CONFIG_DYNAMIC_FTRACE=y or CONFIG_RELOCATABLE=y.

This patch replaces init_thread_info with task_thread_info(&init_task)
and fixes the method to relocate task pointer and stack pointer to new
kernel image for kaslr.

Signed-off-by: default avatarHe Chuyue <hechuyue@wxiat.com>
Reviewed-by: default avatarHe Sheng <hesheng@wxiat.com>
Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
parent 083122ee
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -100,10 +100,12 @@ void arch_ftrace_update_code(int command)

int __init ftrace_dyn_arch_init(void)
{
	init_thread_info.dyn_ftrace_addr = FTRACE_ADDR;
	struct thread_info *ti = task_thread_info(&init_task);

	ti->dyn_ftrace_addr = FTRACE_ADDR;

#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
	init_thread_info.dyn_ftrace_regs_addr = FTRACE_REGS_ADDR;
	ti->dyn_ftrace_regs_addr = FTRACE_REGS_ADDR;
#endif
	return 0;
}
+3 −1
Original line number Diff line number Diff line
@@ -40,8 +40,10 @@ __start:
	call	$26, relocate_kernel
	ldl	$29, 0($30)
	addl	$29, $0, $29
	addl	$8, $0, $8
	ldi	$30, 8($30)
	/* Repoint the sp into the new kernel image */
	ldi	$30, ASM_THREAD_SIZE($8)
	addl	$30, $0, $30
#endif
	/* ... and then we can start the kernel.  */
	call	$26, sw64_start_kernel
+0 −3
Original line number Diff line number Diff line
@@ -239,9 +239,6 @@ unsigned int __init relocate_kernel(void)
		if (plat_post_relocation(offset))
			goto out;

		/* The current thread is now within the relocated image */
		__current_thread_info = RELOCATED(&init_thread_union);

		/* Return the new kernel's offset */
		return offset;
	}