trampoline.s

来自「arm7,44b0芯片的blob程序,适用于学嵌入式linux的新手.」· S 代码 · 共 96 行

S
96
字号
/* * trampoline.S: start of second stage boot loader, jump from assembly to C * * Copyright (C) 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * */.ident "$Id: trampoline.S,v 1.3 2001/10/28 20:34:41 erikm Exp $"#ifdef HAVE_CONFIG_H# include <blob/config.h>#endif#include <blob/arch.h>.text.globl _trampoline_trampoline:	/* clear the BSS section */	ldr	r1, bss_start	ldr	r0, bss_end	sub	r0, r0, r1	/* r1 = start address */	/* r0 = #number of bytes */	mov	r2, #0clear_bss:	stmia	r1!, {r2}	subs	r0, r0, #4	bne	clear_bss	/* setup the stack pointer */	mrs	r0, cpsr	bic	r0, r0, #0x1f	orr	r1, r0, #0xdb	msr	cpsr_cxsf, r1	adr	sp, irqstack	mrs	r0, cpsr	bic	r0, r0, #0x1f	orr	r1, r0, #0xd7	msr	cpsr_cxsf, r1	adr	sp, irqstack	mrs	r0, cpsr	bic	r0, r0, #0x1f	orr	r1, r0, #0xd2	msr	cpsr_cxsf, r1	adr	sp, irqstack	mrs	r0, cpsr	bic	r0, r0, #0x1f	orr	r1, r0, #0xd1	msr	cpsr_cxsf, r1	adr	sp, irqstack	bic	r0, r0, #0x1f	orr	r1, r0, #0xd3	msr	cpsr_cxsf, r1	ldr	r0, stack_end	sub	sp, r0, #4	mrs	r0, cpsr	bic	r0, r0, #0x80	msr	cpsr, r0	/* jump to C code */	bl	main	/* if main ever returns we just call it again */	b	_trampoline.global ticksticks:		.word	1bss_start:	.word	__bss_startbss_end:	.word	__bss_endstack_end:	.word	__stack_end		.space(128)irqstack:

⌨️ 快捷键说明

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