From a6ed30fd5ec698ac3943a4905f21baaa816c10f9 Mon Sep 17 00:00:00 2001 From: songyanguang <345810377@qq.com> Date: Wed, 22 Jan 2025 16:26:12 +0800 Subject: [PATCH] Delete invalid code --- .../riscv/rv64gc/include/asm/asm-offsets.h | 112 ------------------ .../arch/riscv/rv64gc/include/asm/mmio.h | 2 + .../riscv/rv64gc/preboot_for_jh7110/config.mk | 3 - .../hardkernel/intr/riscv/rv64gc/trampoline.S | 12 +- 4 files changed, 9 insertions(+), 120 deletions(-) diff --git a/Ubiquitous/XiZi_AIoT/hardkernel/arch/riscv/rv64gc/include/asm/asm-offsets.h b/Ubiquitous/XiZi_AIoT/hardkernel/arch/riscv/rv64gc/include/asm/asm-offsets.h index 58e0bf035..24bb3db19 100644 --- a/Ubiquitous/XiZi_AIoT/hardkernel/arch/riscv/rv64gc/include/asm/asm-offsets.h +++ b/Ubiquitous/XiZi_AIoT/hardkernel/arch/riscv/rv64gc/include/asm/asm-offsets.h @@ -1,64 +1,6 @@ #ifndef __ASM_OFFSETS_H__ #define __ASM_OFFSETS_H__ -/* - * DO NOT MODIFY. - * - * This file was generated by Kbuild - */ -#define TASK_THREAD_RA 2232 /* offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_SP 2240 /* offsetof(struct task_struct, thread.sp) */ -#define TASK_THREAD_S0 2248 /* offsetof(struct task_struct, thread.s[0]) */ -#define TASK_THREAD_S1 2256 /* offsetof(struct task_struct, thread.s[1]) */ -#define TASK_THREAD_S2 2264 /* offsetof(struct task_struct, thread.s[2]) */ -#define TASK_THREAD_S3 2272 /* offsetof(struct task_struct, thread.s[3]) */ -#define TASK_THREAD_S4 2280 /* offsetof(struct task_struct, thread.s[4]) */ -#define TASK_THREAD_S5 2288 /* offsetof(struct task_struct, thread.s[5]) */ -#define TASK_THREAD_S6 2296 /* offsetof(struct task_struct, thread.s[6]) */ -#define TASK_THREAD_S7 2304 /* offsetof(struct task_struct, thread.s[7]) */ -#define TASK_THREAD_S8 2312 /* offsetof(struct task_struct, thread.s[8]) */ -#define TASK_THREAD_S9 2320 /* offsetof(struct task_struct, thread.s[9]) */ -#define TASK_THREAD_S10 2328 /* offsetof(struct task_struct, thread.s[10]) */ -#define TASK_THREAD_S11 2336 /* offsetof(struct task_struct, thread.s[11]) */ -#define TASK_TI_FLAGS 0 /* offsetof(struct task_struct, thread_info.flags) */ -#define TASK_TI_PREEMPT_COUNT 8 /* offsetof(struct task_struct, thread_info.preempt_count) */ -#define TASK_TI_KERNEL_SP 16 /* offsetof(struct task_struct, thread_info.kernel_sp) */ -#define TASK_TI_USER_SP 24 /* offsetof(struct task_struct, thread_info.user_sp) */ -#define TASK_TI_CPU 32 /* offsetof(struct task_struct, thread_info.cpu) */ -#define TASK_THREAD_F0 2344 /* offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F1 2352 /* offsetof(struct task_struct, thread.fstate.f[1]) */ -#define TASK_THREAD_F2 2360 /* offsetof(struct task_struct, thread.fstate.f[2]) */ -#define TASK_THREAD_F3 2368 /* offsetof(struct task_struct, thread.fstate.f[3]) */ -#define TASK_THREAD_F4 2376 /* offsetof(struct task_struct, thread.fstate.f[4]) */ -#define TASK_THREAD_F5 2384 /* offsetof(struct task_struct, thread.fstate.f[5]) */ -#define TASK_THREAD_F6 2392 /* offsetof(struct task_struct, thread.fstate.f[6]) */ -#define TASK_THREAD_F7 2400 /* offsetof(struct task_struct, thread.fstate.f[7]) */ -#define TASK_THREAD_F8 2408 /* offsetof(struct task_struct, thread.fstate.f[8]) */ -#define TASK_THREAD_F9 2416 /* offsetof(struct task_struct, thread.fstate.f[9]) */ -#define TASK_THREAD_F10 2424 /* offsetof(struct task_struct, thread.fstate.f[10]) */ -#define TASK_THREAD_F11 2432 /* offsetof(struct task_struct, thread.fstate.f[11]) */ -#define TASK_THREAD_F12 2440 /* offsetof(struct task_struct, thread.fstate.f[12]) */ -#define TASK_THREAD_F13 2448 /* offsetof(struct task_struct, thread.fstate.f[13]) */ -#define TASK_THREAD_F14 2456 /* offsetof(struct task_struct, thread.fstate.f[14]) */ -#define TASK_THREAD_F15 2464 /* offsetof(struct task_struct, thread.fstate.f[15]) */ -#define TASK_THREAD_F16 2472 /* offsetof(struct task_struct, thread.fstate.f[16]) */ -#define TASK_THREAD_F17 2480 /* offsetof(struct task_struct, thread.fstate.f[17]) */ -#define TASK_THREAD_F18 2488 /* offsetof(struct task_struct, thread.fstate.f[18]) */ -#define TASK_THREAD_F19 2496 /* offsetof(struct task_struct, thread.fstate.f[19]) */ -#define TASK_THREAD_F20 2504 /* offsetof(struct task_struct, thread.fstate.f[20]) */ -#define TASK_THREAD_F21 2512 /* offsetof(struct task_struct, thread.fstate.f[21]) */ -#define TASK_THREAD_F22 2520 /* offsetof(struct task_struct, thread.fstate.f[22]) */ -#define TASK_THREAD_F23 2528 /* offsetof(struct task_struct, thread.fstate.f[23]) */ -#define TASK_THREAD_F24 2536 /* offsetof(struct task_struct, thread.fstate.f[24]) */ -#define TASK_THREAD_F25 2544 /* offsetof(struct task_struct, thread.fstate.f[25]) */ -#define TASK_THREAD_F26 2552 /* offsetof(struct task_struct, thread.fstate.f[26]) */ -#define TASK_THREAD_F27 2560 /* offsetof(struct task_struct, thread.fstate.f[27]) */ -#define TASK_THREAD_F28 2568 /* offsetof(struct task_struct, thread.fstate.f[28]) */ -#define TASK_THREAD_F29 2576 /* offsetof(struct task_struct, thread.fstate.f[29]) */ -#define TASK_THREAD_F30 2584 /* offsetof(struct task_struct, thread.fstate.f[30]) */ -#define TASK_THREAD_F31 2592 /* offsetof(struct task_struct, thread.fstate.f[31]) */ -#define TASK_THREAD_FCSR 2600 /* offsetof(struct task_struct, thread.fstate.fcsr) */ -#define TSK_STACK_CANARY 1080 /* offsetof(struct task_struct, stack_canary) */ #define PT_SIZE 288 /* sizeof(struct pt_regs) */ #define PT_EPC 0 /* offsetof(struct pt_regs, epc) */ #define PT_RA 8 /* offsetof(struct pt_regs, ra) */ @@ -97,60 +39,6 @@ #define PT_STATUS 256 /* offsetof(struct pt_regs, status) */ #define PT_BADADDR 264 /* offsetof(struct pt_regs, badaddr) */ #define PT_CAUSE 272 /* offsetof(struct pt_regs, cause) */ -#define SUSPEND_CONTEXT_REGS 0 /* offsetof(struct suspend_context, regs) */ -#define HIBERN_PBE_ADDR 0 /* offsetof(struct pbe, address) */ -#define HIBERN_PBE_ORIG 8 /* offsetof(struct pbe, orig_address) */ -#define HIBERN_PBE_NEXT 16 /* offsetof(struct pbe, next) */ -#define TASK_THREAD_RA_RA 0 /* offsetof(struct task_struct, thread.ra) - offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_SP_RA 8 /* offsetof(struct task_struct, thread.sp) - offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_S0_RA 16 /* offsetof(struct task_struct, thread.s[0]) - offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_S1_RA 24 /* offsetof(struct task_struct, thread.s[1]) - offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_S2_RA 32 /* offsetof(struct task_struct, thread.s[2]) - offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_S3_RA 40 /* offsetof(struct task_struct, thread.s[3]) - offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_S4_RA 48 /* offsetof(struct task_struct, thread.s[4]) - offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_S5_RA 56 /* offsetof(struct task_struct, thread.s[5]) - offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_S6_RA 64 /* offsetof(struct task_struct, thread.s[6]) - offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_S7_RA 72 /* offsetof(struct task_struct, thread.s[7]) - offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_S8_RA 80 /* offsetof(struct task_struct, thread.s[8]) - offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_S9_RA 88 /* offsetof(struct task_struct, thread.s[9]) - offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_S10_RA 96 /* offsetof(struct task_struct, thread.s[10]) - offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_S11_RA 104 /* offsetof(struct task_struct, thread.s[11]) - offsetof(struct task_struct, thread.ra) */ -#define TASK_THREAD_F0_F0 0 /* offsetof(struct task_struct, thread.fstate.f[0]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F1_F0 8 /* offsetof(struct task_struct, thread.fstate.f[1]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F2_F0 16 /* offsetof(struct task_struct, thread.fstate.f[2]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F3_F0 24 /* offsetof(struct task_struct, thread.fstate.f[3]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F4_F0 32 /* offsetof(struct task_struct, thread.fstate.f[4]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F5_F0 40 /* offsetof(struct task_struct, thread.fstate.f[5]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F6_F0 48 /* offsetof(struct task_struct, thread.fstate.f[6]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F7_F0 56 /* offsetof(struct task_struct, thread.fstate.f[7]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F8_F0 64 /* offsetof(struct task_struct, thread.fstate.f[8]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F9_F0 72 /* offsetof(struct task_struct, thread.fstate.f[9]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F10_F0 80 /* offsetof(struct task_struct, thread.fstate.f[10]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F11_F0 88 /* offsetof(struct task_struct, thread.fstate.f[11]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F12_F0 96 /* offsetof(struct task_struct, thread.fstate.f[12]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F13_F0 104 /* offsetof(struct task_struct, thread.fstate.f[13]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F14_F0 112 /* offsetof(struct task_struct, thread.fstate.f[14]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F15_F0 120 /* offsetof(struct task_struct, thread.fstate.f[15]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F16_F0 128 /* offsetof(struct task_struct, thread.fstate.f[16]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F17_F0 136 /* offsetof(struct task_struct, thread.fstate.f[17]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F18_F0 144 /* offsetof(struct task_struct, thread.fstate.f[18]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F19_F0 152 /* offsetof(struct task_struct, thread.fstate.f[19]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F20_F0 160 /* offsetof(struct task_struct, thread.fstate.f[20]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F21_F0 168 /* offsetof(struct task_struct, thread.fstate.f[21]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F22_F0 176 /* offsetof(struct task_struct, thread.fstate.f[22]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F23_F0 184 /* offsetof(struct task_struct, thread.fstate.f[23]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F24_F0 192 /* offsetof(struct task_struct, thread.fstate.f[24]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F25_F0 200 /* offsetof(struct task_struct, thread.fstate.f[25]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F26_F0 208 /* offsetof(struct task_struct, thread.fstate.f[26]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F27_F0 216 /* offsetof(struct task_struct, thread.fstate.f[27]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F28_F0 224 /* offsetof(struct task_struct, thread.fstate.f[28]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F29_F0 232 /* offsetof(struct task_struct, thread.fstate.f[29]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F30_F0 240 /* offsetof(struct task_struct, thread.fstate.f[30]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_F31_F0 248 /* offsetof(struct task_struct, thread.fstate.f[31]) - offsetof(struct task_struct, thread.fstate.f[0]) */ -#define TASK_THREAD_FCSR_F0 256 /* offsetof(struct task_struct, thread.fstate.fcsr) - offsetof(struct task_struct, thread.fstate.f[0]) */ #define PT_SIZE_ON_STACK 288 /* ALIGN(sizeof(struct pt_regs), STACK_ALIGN) */ -#define KERNEL_MAP_VIRT_ADDR 0 /* offsetof(struct kernel_mapping, virt_addr) */ -#define SBI_HART_BOOT_TASK_PTR_OFFSET 0 /* offsetof(struct sbi_hart_boot_data, task_ptr) */ -#define SBI_HART_BOOT_STACK_PTR_OFFSET 8 /* offsetof(struct sbi_hart_boot_data, stack_ptr) */ #endif diff --git a/Ubiquitous/XiZi_AIoT/hardkernel/arch/riscv/rv64gc/include/asm/mmio.h b/Ubiquitous/XiZi_AIoT/hardkernel/arch/riscv/rv64gc/include/asm/mmio.h index a3aaf27e5..bd1007705 100644 --- a/Ubiquitous/XiZi_AIoT/hardkernel/arch/riscv/rv64gc/include/asm/mmio.h +++ b/Ubiquitous/XiZi_AIoT/hardkernel/arch/riscv/rv64gc/include/asm/mmio.h @@ -17,6 +17,8 @@ #include +#define CONFIG_64BIT 1 + typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; diff --git a/Ubiquitous/XiZi_AIoT/hardkernel/arch/riscv/rv64gc/preboot_for_jh7110/config.mk b/Ubiquitous/XiZi_AIoT/hardkernel/arch/riscv/rv64gc/preboot_for_jh7110/config.mk index b016e2557..5bcfefbdf 100644 --- a/Ubiquitous/XiZi_AIoT/hardkernel/arch/riscv/rv64gc/preboot_for_jh7110/config.mk +++ b/Ubiquitous/XiZi_AIoT/hardkernel/arch/riscv/rv64gc/preboot_for_jh7110/config.mk @@ -1,15 +1,12 @@ export CROSS_COMPILE ?= riscv64-unknown-elf- export ARCH = riscv -# export KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -fno-stack-protector -Wno-main -fomit-frame-pointer -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -fno-strict-overflow -fno-stack-check -Werror=date-time export KBUILD_CFLAGS := -Wall -Wundef -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -fno-stack-protector -Wno-main -fomit-frame-pointer -Wvla -Wno-pointer-sign -Wno-array-bounds -fno-strict-overflow -fno-stack-check -Werror=date-time -export KBUILD_CPPFLAGS := -D__KERNEL__ export KBUILD_AFLAGS := export CHECKFLAGS += -D__riscv -D__riscv_xlen=64 export DEVICE := export CFLAGS := $(KBUILD_CFLAGS) $(KBUILD_AFLAGS) $(CHECKFLAGS) -std=c11 -mcmodel=medany -# .vmlinux.cmd:1:cmd_vmlinux := sh scripts/link-vmlinux.sh "riscv64-linux-gnu-ld" " -melf64lriscv" " --build-id=sha1"; export LFLAGS := -T $(KERNEL_ROOT)/hardkernel/arch/riscv/rv64gc/preboot_for_jh7110/jh7110.lds export CXXFLAGS := diff --git a/Ubiquitous/XiZi_AIoT/hardkernel/intr/riscv/rv64gc/trampoline.S b/Ubiquitous/XiZi_AIoT/hardkernel/intr/riscv/rv64gc/trampoline.S index 44fac5f1e..eef6e6fed 100644 --- a/Ubiquitous/XiZi_AIoT/hardkernel/intr/riscv/rv64gc/trampoline.S +++ b/Ubiquitous/XiZi_AIoT/hardkernel/intr/riscv/rv64gc/trampoline.S @@ -37,16 +37,18 @@ Modification: .align 4 .global handle_exception handle_exception: + # Here tp is struct thread_info csrrw tp, CSR_SCRATCH, tp bnez tp, _save_context _restore_kernel_tpsp: csrr tp, CSR_SCRATCH - REG_S sp, TASK_TI_KERNEL_SP(tp) + REG_S sp, 16(tp) _save_context: - REG_S sp, TASK_TI_USER_SP(tp) - REG_L sp, TASK_TI_KERNEL_SP(tp) + REG_S sp, 24(tp) + REG_L sp, 16(tp) + # Here sp is struct trapframe addi sp, sp, -(PT_SIZE_ON_STACK) REG_S x1, PT_RA(sp) REG_S x3, PT_GP(sp) @@ -87,7 +89,7 @@ _save_context: */ li t0, SR_SUM | SR_FS - REG_L s0, TASK_TI_USER_SP(tp) + REG_L s0, 24(tp) csrrc s1, CSR_STATUS, t0 csrr s2, CSR_EPC csrr s3, CSR_TVAL @@ -208,7 +210,7 @@ ret_from_exception: resume_userspace: /* Save unwound kernel stack pointer in thread_info */ addi s0, sp, PT_SIZE_ON_STACK - REG_S s0, TASK_TI_KERNEL_SP(tp) + REG_S s0, 16(tp) /* * Save TP into the scratch register , so we can find the kernel data