免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 1991 | 回复: 11
打印 上一主题 下一主题

linux kernel reboot 文体 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-07-05 17:03 |只看该作者 |倒序浏览
我现在买了一块intel 506 系列64位的cpu,我安装linux系统引导,可是在machine_restart处死机,我查看了源代码,/x86_64/kernel/reboot.c好像是缺少函数machine_real_restart,可是不知道在这应该添加?

论坛徽章:
0
2 [报告]
发表于 2005-07-05 18:32 |只看该作者

linux kernel reboot 文体

兄台,,/x86_64/kernel/reboot.c根本没有reboot.c文件。
再说,你给的路径也不对。少arch。

论坛徽章:
0
3 [报告]
发表于 2005-07-06 09:19 |只看该作者

linux kernel reboot 文体

我用的是kernel 2.6.12,不知道你用的是哪个内核啊

论坛徽章:
0
4 [报告]
发表于 2005-07-06 11:37 |只看该作者

linux kernel reboot 文体

那你为什么,不说明版本呢?

论坛徽章:
0
5 [报告]
发表于 2005-07-06 11:48 |只看该作者

linux kernel reboot 文体

void machine_real_restart(unsigned char *code, int length)
{
        unsigned long flags;

        local_irq_disable();

        /* Write zero to CMOS register number 0x0f, which the BIOS POST
           routine will recognize as telling it to do a proper reboot.  (Well
           that's what this book in front of me says -- it may only apply to
           the Phoenix BIOS though, it's not clear).  At the same time,
           disable NMIs by setting the top bit in the CMOS address register,
           as we're about to do peculiar things to the CPU.  I'm not sure if
           `outb_p' is needed instead of just `outb'.  Use it to be on the
           safe side.  (Yes, CMOS_WRITE does outb_p's. -  Paul G.)
         */

        spin_lock_irqsave(&rtc_lock, flags);
        CMOS_WRITE(0x00, 0x8f);
        spin_unlock_irqrestore(&rtc_lock, flags);

        /* Remap the kernel at virtual address zero, as well as offset zero
           from the kernel segment.  This assumes the kernel segment starts at
           virtual address PAGE_OFFSET. */

        memcpy (swapper_pg_dir, swapper_pg_dir + USER_PGD_PTRS,
                sizeof (swapper_pg_dir [0]) * KERNEL_PGD_PTRS);

        /*
         * Use `swapper_pg_dir' as our page directory.
         */
        load_cr3(swapper_pg_dir);

        /* Write 0x1234 to absolute memory location 0x472.  The BIOS reads
           this on booting to tell it to "Bypass memory test (also warm
           boot)".  This seems like a fairly standard thing that gets set by
           REBOOT.COM programs, and the previous reset routine did this
           too. */

        *((unsigned short *)0x472) = reboot_mode;

        /* For the switch to real mode, copy some code to low memory.  It has
           to be in the first 64k because it is running in 16-bit mode, and it
           has to have the same physical and virtual address, because it turns
           off paging.  Copy it near the end of the first page, out of the way
           of BIOS variables. */

        memcpy ((void *) (0x1000 - sizeof (real_mode_switch) - 100),
                real_mode_switch, sizeof (real_mode_switch));
        memcpy ((void *) (0x1000 - 100), code, length);

        /* Set up the IDT for real mode. */

        __asm__ __volatile__ ("lidt %0" : : "m" (real_mode_idt));

        /* Set up a GDT from which we can load segment descriptors for real
           mode.  The GDT is not used in real mode; it is just needed here to
           prepare the descriptors. */

        __asm__ __volatile__ ("lgdt %0" : : "m" (real_mode_gdt));

        /* Load the data segment registers, and thus the descriptors ready for
           real mode.  The base address of each segment is 0x100, 16 times the
           selector value being loaded here.  This is so that the segment
           registers don't have to be reloaded after switching to real mode:
           the values are consistent for real mode operation already. */

        __asm__ __volatile__ ("movl $0x0010,%%eax\n"
                                "\tmovl %%eax,%%ds\n"
                                "\tmovl %%eax,%%es\n"
                                "\tmovl %%eax,%%fs\n"
                                "\tmovl %%eax,%%gs\n"
                                "\tmovl %%eax,%%ss" : : : "eax";

        /* Jump to the 16-bit code that we copied earlier.  It disables paging
           and the cache, switches to real mode, and jumps to the BIOS reset
           entry point. */

        __asm__ __volatile__ ("ljmp $0x0008,%0"
                                :
                                : "i" ((void *) (0x1000 - sizeof (real_mode_switch) - 100)));
}

论坛徽章:
0
6 [报告]
发表于 2005-07-06 11:50 |只看该作者

linux kernel reboot 文体

就在machine_restart( )函数上边定义的.

论坛徽章:
0
7 [报告]
发表于 2005-07-07 11:23 |只看该作者

linux kernel reboot 文体

我用的也是kernel 2.6.12,我用的是intel 506的cpu,你用的肯定不是这个行好 的, 而且我事用x86_64起动的

论坛徽章:
0
8 [报告]
发表于 2005-07-07 17:46 |只看该作者

linux kernel reboot 文体

我自己顶一下,

论坛徽章:
33
荣誉会员
日期:2011-11-23 16:44:17天秤座
日期:2014-08-26 16:18:20天秤座
日期:2014-08-29 10:12:18丑牛
日期:2014-08-29 16:06:45丑牛
日期:2014-09-03 10:28:58射手座
日期:2014-09-03 16:01:17寅虎
日期:2014-09-11 14:24:21天蝎座
日期:2014-09-17 08:33:55IT运维版块每日发帖之星
日期:2016-04-17 06:23:27操作系统版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-24 06:20:0015-16赛季CBA联赛之天津
日期:2016-05-06 12:46:59
9 [报告]
发表于 2005-07-07 18:16 |只看该作者

linux kernel reboot 文体

小声问一下楼主,
你的机器在安装时装的是 for x86 的 Linux , 还是 for x86_64 的 Linux ?
你的机器启不来, 你是怎么查的源代码?

论坛徽章:
0
10 [报告]
发表于 2005-07-08 12:19 |只看该作者

linux kernel reboot 文体

在machine_restart中的outb(oxfe,ox64);不明白何意阿,
那位帮一下阿
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP