linux内核源码系统调用有多少个,Linux内核源代码分析——第5章 reboot 系 统 调 用...

讲述如何实现linux内核的reboot

linux/kernel/sys.c:

asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void * arg)

这里提供系统调用reboot。可以通过lib引用完成。

case LINUX_REBOOT_CMD_RESTART:

notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);

printk(KERN_EMERG "Restarting system.\n");

machine_restart(NULL);

break;

linux/arch/arm/kernel/process.c

void machine_restart(char * __unused)

{

/*

* Clean and disable cache, and turn off interrupts

*/

cpu_proc_fin();

/*

* Tell the mm system that we are going to reboot -

* we may need it to insert some 1:1 mappings so that

* soft boot works.

*/

setup_mm_for_reboot(reboot_mode);

/*

* Now call the architecture specific reboot code.

*/

arch_reset(reboot_mode);

/*

* Whoops - the architecture was unable to reboot.

* Tell the user!

*/

mdelay(1000);

printk("Reboot failed -- System halted\n");

while (1);

}

linux/include/asm-arm/cpu-multi32.h:

extern const struct processor arm7_processor_functions;

#define cpu_proc_fin()    processor._proc_fin()

linux/arch/arm/mm/proc-arm6,7.S:

/*

* Purpose : Function pointers used to access above functions - all calls

*      come through these

*/

.type arm7_processor_functions, #object

ENTRY(arm7_processor_functions)

.word cpu_arm7_data_abort

.word cpu_arm7_check_bugs

.word cpu_arm7_proc_init

.word cpu_arm7_proc_fin

.word cpu_arm7_reset

.word cpu_arm7_do_idle

/* cache */

.word cpu_arm7_cache_clean_invalidate_all

.word cpu_arm7_cache_clean_invalidate_range

.word cpu_arm7_flush_ram_page

/* dcache */

.word cpu_arm7_dcache_invalidate_range

.word cpu_arm7_dcache_clean_range

.word cpu_arm7_dcache_clean_page

.word cpu_arm7_dcache_clean_entry

/* icache */

.word cpu_arm7_icache_invalidate_range

.word cpu_arm7_icache_invalidate_page

/* tlb */

.word cpu_arm7_tlb_invalidate_all

.word cpu_arm7_tlb_invalidate_range

.word cpu_arm7_tlb_invalidate_page

/* pgtable */

.word cpu_arm7_set_pgd

.word cpu_arm7_set_pmd

.word cpu_arm7_set_pte

.size arm7_processor_functions, . - arm7_processor_functions

linux/include/asm-arm/arch-sa1100/system.h:

static inline void arch_reset(char mode)

{

if (mode == 's') {

/* Jump into ROM at address 0 */

cpu_reset(0);

} else {

/* Use on-chip reset capability */

RSRR = RSRR_SWR;

}

}

linux/include/asm-arm/cpu-multi32.h:

#define cpu_reset(addr)    processor.reset(addr)

linux/arch/arm/mm/proc-arm6,7.S:

ENTRY(cpu_arm7_reset)

mov r1, #0

mcr p15, 0, r1, c7, c0, 0  @ flush cache

mcr p15, 0, r1, c5, c0, 0  @ flush TLB

mov r1, #0x30

mcr p15, 0, r1, c1, c0, 0  @ turn off MMU etc

mov pc, r0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值