⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 head.s

📁 linux-2.4.29操作系统的源码
💻 S
📖 第 1 页 / 共 5 页
字号:
 *   1. Processor number *   2. Segment table pointer (virtual address) * On entry the following are set: *   r1    = stack pointer.  vaddr for iSeries, raddr (temp stack) for pSeries *   r24   = cpu# (in Linux terms) *   r13   = paca virtual address *   SPRG3 = paca virtual address */_GLOBAL(__secondary_start)	HMT_MEDIUM			/* Set thread priority to MEDIUM */	/* set up the TOC (virtual address) */	LOADADDR(r2,__toc_start)	addi    r2,r2,0x4000	addi    r2,r2,0x4000	std	r2,PACATOC(r13)	li	r6,0	std	r6,PACAKSAVE(r13)	stb	r6,PACAPROCENABLED(r13)#ifndef CONFIG_PPC_ISERIES	/* Initialize the page table pointer register. */	LOADADDR(r6,_SDR1)	ld	r6,0(r6)		/* get the value of _SDR1 */	mtspr	SDR1,r6			/* set the htab location  */#endif	/* Initialize the first segment table (or SLB) entry                */	ld	r3,PACASTABVIRT(r13)    /* get addr of segment table        */	bl	.stab_initialize	/* Initialize the kernel stack.  Just a repeat for iSeries.         */	LOADADDR(r3,current_set)	sldi	r28,r24,4		/* get current_set[cpu#] */	ldx	r28,r3,r28	std	r28,PACACURRENT(r13)	addi	r1,r28,TASK_UNION_SIZE	subi	r1,r1,STACK_FRAME_OVERHEAD	ld	r3,PACASTABREAL(r13)    /* get raddr of segment table       */	ori	r4,r3,1			/* turn on valid bit                */#ifdef CONFIG_PPC_ISERIES	li	r0,-1			/* hypervisor call */	li	r3,1	sldi	r3,r3,63		/* 0x8000000000000000 */	ori	r3,r3,4			/* 0x8000000000000004 */	sc				/* HvCall_setASR */#else	/* set the ASR */	li	r3,0x5000	/* r3 = ptr to systemcfg  */	lwz   	r3,PLATFORM(r3) /* r3 = platform flags */	cmpldi 	r3,PLATFORM_PSERIES_LPAR	bne   	98f	mfspr	r3,PVR	srwi	r3,r3,16	cmpwi	r3,0x37         /* SStar  */	beq	97f	cmpwi	r3,0x36         /* IStar  */	beq	97f	cmpwi	r3,0x34         /* Pulsar */	bne	98f97:	li	r3,H_SET_ASR    /* hcall = H_SET_ASR */	HSC     		/* Invoking hcall */	b	99f98:                             /* !(rpa hypervisor) || !(sstar) */	mtasr	r4	        /* set the stab location         */99:#endif	li	r7,0	mtlr	r7	/* enable MMU and jump to start_secondary */	LOADADDR(r3,.start_secondary_prolog)	SET_REG_TO_CONST(r4, MSR_KERNEL)#ifdef DO_SOFT_DISABLE	ori	r4,r4,MSR_EE#endif	mtspr	SRR0,r3	mtspr	SRR1,r4	rfid/*  * Running with relocation on at this point.  All we want to do is * zero the stack back-chain pointer before going into C code. */_GLOBAL(start_secondary_prolog)	li	r3,0	std	r3,0(r1)                /* Zero the stack frame pointer     */	bl	.start_secondary#endif /* CONFIG_SMP *//* * This subroutine clobbers r11, r12 and the LR */_GLOBAL(enable_64b_mode)	mfmsr   r11                      /* grab the current MSR */	li      r12,1	rldicr  r12,r12,MSR_SF_LG,(63-MSR_SF_LG)	or      r11,r11,r12	li      r12,1	rldicr  r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG)	or      r11,r11,r12	mtmsrd  r11	isync	blr/* * This subroutine clobbers r11, r12 and the LR */_GLOBAL(enable_32b_mode)	mfmsr   r11                      /* grab the current MSR */	li      r12,1	rldicr  r12,r12,MSR_SF_LG,(63-MSR_SF_LG)	andc	r11,r11,r12	li      r12,1	rldicr  r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG)	andc	r11,r11,r12	mtmsrd  r11	isync	blr/* * This is where the main kernel code starts. */_STATIC(start_here_pSeries)	/* get a new offset, now that the kernel has moved. */	bl	.reloc_offset	mr	r26,r3	mfmsr	r6	ori	r6,r6,MSR_RI	mtmsrd	r6			/* RI on */	/* setup the systemcfg pointer which is needed by *tab_initialize  */	LOADADDR(r6,systemcfg)	sub	r6,r6,r26                /* addr of the variable systemcfg */	li	r27,0x5000	std	r27,0(r6)	 	 /* set the value of systemcfg     */	/* setup the naca pointer which is needed by *tab_initialize       */	LOADADDR(r6,naca)	sub	r6,r6,r26                /* addr of the variable naca      */	li	r27,0x4000	std	r27,0(r6)	 	 /* set the value of naca          */#ifdef CONFIG_HMT	/* Start up the second thread on cpu 0 */	mfspr	r3,PVR	srwi	r3,r3,16	cmpwi	r3,0x34                 /* Pulsar  */	beq	90f	cmpwi	r3,0x36                 /* Icestar */	beq	90f	cmpwi	r3,0x37                 /* SStar   */	beq	90f	b	91f                     /* HMT not supported */90:	li      r3,0	bl	.hmt_start_secondary91:#endif#ifdef CONFIG_SMP	/* All secondary cpus are now spinning on a common	 * spinloop, release them all now so they can start	 * to spin on their individual paca spinloops.	 * For non SMP kernels, the secondary cpus never	 * get out of the common spinloop.	 */	li	r3,1	LOADADDR(r5,__secondary_hold_spinloop)	tophys(r4,r5)	std     r3,0(r4)#endif	/* The following gets the stack and TOC set up with the regs */	/* pointing to the real addr of the kernel stack.  This is   */	/* all done to support the C function call below which sets  */	/* up the htab.  This is done because we have relocated the  */	/* kernel but are still running in real mode. */	/* real ptr to current */	LOADADDR(r3,init_task_union)	sub	r3,r3,r26	/* set up a stack pointer (physical address) */	addi	r1,r3,TASK_UNION_SIZE	li	r0,0	stdu	r0,-STACK_FRAME_OVERHEAD(r1)	LOADADDR(r3,cpu_specs)	sub	r3,r3,r26	LOADADDR(r4,cur_cpu_spec)	sub	r4,r4,r26	mr	r5,r26	bl	.identify_cpu	/* set up the TOC (physical address) */	LOADADDR(r2,__toc_start)	addi    r2,r2,0x4000	addi    r2,r2,0x4000	sub	r2,r2,r26	/* Get the pointer to the segment table which is used by           */	/* stab_initialize                                                 */	li	r27,0x4000	ld	r6,PACA(r27)            /* Get the base paca pointer       */	sub	r13,r6,r26		/* convert to physical addr         */	mtspr	SPRG3,r13		/* PPPBBB: Temp... -Peter */	ld	r3,PACASTABREAL(r13)	ori	r4,r3,1			/* turn on valid bit                */	/* set the ASR */	li	r3,0x5000	/* r3 = ptr to systemcfg */	lwz   	r3,PLATFORM(r3) /* r3 = platform flags */	cmpldi 	r3,PLATFORM_PSERIES_LPAR	bne   	98f	mfspr	r3,PVR	srwi	r3,r3,16	cmpwi	r3,0x37         /* SStar */	beq	97f	cmpwi	r3,0x36         /* IStar  */	beq	97f	cmpwi	r3,0x34         /* Pulsar */	bne	98f97:	li	r3,H_SET_ASR    /* hcall = H_SET_ASR */	HSC     	        /* Invoking hcall */	b     	99f98:                 /* This is not a hypervisor machine */	mtasr	r4			/* set the stab location            */99:	mfspr	r6,SPRG3	ld	r3,PACASTABREAL(r6)     /* restore r3 for stab_initialize */	/* Initialize an initial memory mapping and turn on relocation.   */	bl	.stab_initialize	bl	.htab_initialize	li	r3,0x5000	/* r3 = ptr to systemcfg */	lwz	r3,PLATFORM(r3) /* r3 = platform flags */	cmpldi r3,PLATFORM_PSERIES	bne    98f	LOADADDR(r6,_SDR1)		/* Only if NOT LPAR */	sub	r6,r6,r26	ld	r6,0(r6)		/* get the value of _SDR1 */	mtspr	SDR1,r6			/* set the htab location  */98: 	LOADADDR(r3,.start_here_common)	SET_REG_TO_CONST(r4, MSR_KERNEL)	mtspr	SRR0,r3	mtspr	SRR1,r4	rfid	/* This is where all platforms converge execution */_STATIC(start_here_common)	/* relocation is on at this point */	/* Clear out the BSS */	LOADADDR(r11,_end)	LOADADDR(r8,__bss_start)	sub	r11,r11,r8        /* bss size                        */	addi	r11,r11,7         /* round up to an even double word */	rldicl. r11,r11,61,3      /* shift right by 3                */	beq	4f	addi	r8,r8,-8	li	r0,0	mtctr	r11		  /* zero this many doublewords      */3:	stdu	r0,8(r8)	bdnz	3b4:	/* The following code sets up the SP and TOC now that we are */	/* running with translation enabled. */	/* ptr to current */	LOADADDR(r3,init_task_union)	/* set up the stack */	addi	r1,r3,TASK_UNION_SIZE	li	r0,0	stdu	r0,-STACK_FRAME_OVERHEAD(r1)	/* set up the TOC */	LOADADDR(r2,__toc_start)	addi    r2,r2,0x4000	addi    r2,r2,0x4000	li	r3,0	bl	.do_cpu_ftr_fixups	/* setup the systemcfg pointer                                       */	LOADADDR(r9,systemcfg)	SET_REG_TO_CONST(r8, KERNELBASE+0x5000)	std	r8,0(r9)	/* setup the naca pointer                                         */	LOADADDR(r9,naca)	SET_REG_TO_CONST(r8, KERNELBASE+0x4000)	std	r8,0(r9)		/* set the value of the naca ptr  */	LOADADDR(r4,naca)               /* Get naca ptr address           */	ld	r4,0(r4)                /* Get the location of the naca   */	ld	r13,PACA(r4)            /* Get the base paca pointer      */	mtspr	SPRG3,r13	/* ptr to current */	LOADADDR(r4,init_task_union)	std	r4,PACACURRENT(r13)	std	r2,PACATOC(r13)	li	r5,0	std	r0,PACAKSAVE(r13)	/* ptr to hardware interrupt stack for processor 0                */	LOADADDR(r3, hardware_int_paca0)	li      r5,0x1000	sldi    r5,r5,3	subi    r5,r5,STACK_FRAME_OVERHEAD	add     r3,r3,r5	std     r3,PACAHRDWINTSTACK(r13)	li      r3,0	stb     r3,PACAHRDWINTCOUNT(r13)	/* Restore the parms passed in from the bootloader. */	mr	r3,r31	mr	r4,r30	mr	r5,r29	mr	r6,r28	mr	r7,r27	bl	.setup_system	/* Load up the kernel context */5:#ifdef DO_SOFT_DISABLE	mfspr	r4,SPRG3	li	r5,0	stb	r5,PACAPROCENABLED(r4)	/* Soft Disabled */	mfmsr	r5	ori	r5,r5,MSR_EE		/* Hard Enabled */	mtmsrd	r5#endif	bl .start_kernel_GLOBAL(__setup_cpu_power3)	blr_GLOBAL(__setup_cpu_power4)	blr_GLOBAL(hmt_init)#ifdef CONFIG_HMT	LOADADDR(r5, hmt_thread_data)	mfspr	r7,PVR	srwi	r7,r7,16	cmpwi	r7,0x34                 /* Pulsar  */	beq	90f	cmpwi	r7,0x36                 /* Icestar */	beq	91f	cmpwi	r7,0x37                 /* SStar   */	beq	91f	b	101f90:	mfspr	r6,PIR	andi.	r6,r6,0x1f	b	92f91:	mfspr	r6,PIR	andi.	r6,r6,0x3ff92:	sldi	r4,r24,3	stwx	r6,r5,r4	bl	.hmt_start_secondary	b	101f__hmt_secondary_hold:	LOADADDR(r5, hmt_thread_data)	clrldi	r5,r5,4	li	r7,0	mfspr	r6,PIR	mfspr	r8,PVR	srwi	r8,r8,16	cmpwi	r8,0x34	bne	93f	andi.	r6,r6,0x1f	b	103f93:	andi.	r6,r6,0x3f103:	lwzx	r8,r5,r7	cmpw	r8,r6	beq	104f	addi	r7,r7,8	b	103b104:	addi	r7,r7,4	lwzx	r9,r5,r7	mr      r24,r9101:#endif	mr      r3,r24	b       .pseries_secondary_smp_init#ifdef CONFIG_HMT_GLOBAL(hmt_start_secondary)	LOADADDR(r4,__hmt_secondary_hold)	clrldi	r4,r4,4	mtspr   NIADORM, r4	mfspr   r4, MSRDORM	li      r5, -65	and     r4, r4, r5	mtspr   MSRDORM, r4	lis	r4,0xffef	ori	r4,r4,0x7403	mtspr	TSC, r4	li	r4,0x1f4	mtspr	TST, r4	mfspr   r4, HID0	ori     r4, r4, 0x1	mtspr   HID0, r4	mfspr   r4, CTRLF	oris    r4, r4, 0x40	mtspr   CTRLT, r4	blr#endif/* * We put a few things here that have to be page-aligned. * This stuff goes at the beginning of the data segment, * which is page-aligned. */	.data	.align  12	.globl	sdatasdata:	.globl	empty_zero_pageempty_zero_page:	.space	4096	.globl	swapper_pg_dirswapper_pg_dir:	.space	4096	.globl	ioremap_dirioremap_dir:	.space	4096	.globl	bolted_dirbolted_dir:	.space	4096	.globl  hardware_int_paca0hardware_int_paca0:	.space	8*4096/* 1 page segment table per cpu (max 48, cpu0 allocated at STAB0_PHYS_ADDR) */	.globl	stab_arraystab_array:        .space	4096 * (48 - 1)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -