2008年5月30日 星期五

EeePC Fast Reboot process

"kill -USR1 1"(in /sbin/fastreboot.sh)->

"reboot(LINUX_REBOOT_CMD_RESTART);"(finit.c)->

reboot (int howto)(glibc/sysdeps/unix/sysv/linux/reboot.c)->

(P.S.
LINUX_REBOOT_CMD_RESTART==RB_AUTOBOOT== 0x1234567
)

(Refer.
http://homepages.cwi.nl/~aeb/linux/man2html/man2/reboot.2.html
)

INLINE_SYSCALL (
reboot, 3, (int) 0xfee1dead, 672274793,
LINUX_REBOOT_CMD_RESTART
)
(glibc/sysdeps/unix/sysv/linux/reboot.c)->




sys_reboot(
(int) 0xfee1dead, 672274793,
LINUX_REBOOT_CMD_RESTART, void __user * arg
)
(linux-src/kernel/sys.c)->

kernel_restart(NULL)(linux-src/kernel/sys.c)->

kernel_restart_prepare(NULL);
printk(KERN_EMERG "Restarting system.\n")
machine_restart(LINUX_REBOOT_CMD_RESTART);
(linux-src/kernel/sys.c)->

//called from kernel_restart_prepare
notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);
system_state = SYSTEM_RESTART;
device_shutdown();
(linux-src/kernel/sys.c)

//called from machine_restart
machine_shutdown();
machine_emergency_restart();
(arch/i386/kernel/reboot.c)

->

//called from machine_emergency_restart()
static unsigned char jump_to_bios [] =
{
0xea, 0x00, 0x00, 0xff, 0xff /* ljmp $0xffff,$0x0000 */
};
machine_real_restart(jump_to_bios, sizeof(jump_to_bios));
(arch/i386/kernel/reboot.c)


->


/*
* Switch to real mode and then execute the code
* specified by the code and length parameters.
* We assume that length will aways be less that 100!
*/
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. */

load_idt(&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. */

load_gdt(&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)));
}

14 則留言:

匿名 提到...

professional answer to this insurance question: Do all states require car insurance? http://insuranceinstates.com/missouri/Springfield/Met%20Life/65804/

匿名 提到...

buy valium online buy valium cheap online - 3 5 mg valium

匿名 提到...

Every weekend i used to pay a visit this site, for the reason that i wish for enjoyment, as this this web site conations truly nice funny material
too.

Here is my webpage - http://wiki.lespetitsdebrouillardsbretagne.org/

匿名 提到...

Saved as a favorite, I really like your site!


My weblog; buy A used car In boston

匿名 提到...

Very good article. I'm experiencing a few of these issues as well..

Look into my homepage ... male enhancement information

匿名 提到...

Hey there! This is my 1st comment here so I just wanted to give a
quick shout out and tell you I genuinely enjoy reading your articles.
Can you suggest any other blogs/websites/forums that cover the
same topics? Thank you!

Here is my webpage ... morecoldair.blogspot.com

匿名 提到...

I simply could not leave your site prior to
suggesting that I really enjoyed the standard information a person provide in
your guests? Is gonna be again incessantly to check out new posts

Stop by my web page; smoke Deter

匿名 提到...

Way cool! Some very valid points! I appreciate you
writing this write-up and the rest of the website is also very good.


Feel free to visit my blog ... hgh energizer review

匿名 提到...

When some one searches for his required thing, so he/she desires to be available that in
detail, so that thing is maintained over here.

Take a look at my web blog; airbnb coupon code

匿名 提到...

It's very easy to find out any matter on web as compared to textbooks, as I found this piece of writing at this website.

Also visit my homepage; get my ex girlfriend back

匿名 提到...

This is very fascinating, You're an overly skilled blogger. I have joined your feed and sit up for looking for more of your great post. Also, I have shared your web site in my social networks

My webpage - airbnb coupon code 2013

匿名 提到...

Does yοur blog haѵe a contact pagе?
I'm having a tough time locating it but, I'd like to ѕеnd you аn e-mail.
I've got some recommendations for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it grow over time.

my blog post - cash for cars nj **

匿名 提到...

I have been browsing online greater than 3 hours these days, but I by no means found any
fascinating article like yours. It's beautiful price enough for me. Personally, if all website owners and bloggers made excellent content material as you probably did, the internet will be a lot more helpful than ever before.

Also visit my web page; what to do to get your ex back

匿名 提到...

Whats up this is kinda of off topic but I was wanting
to know if blogs use WYSIWYG editors or if you have to manually code with
HTML. I'm starting a blog soon but have no coding skills so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

My website ... home rentals in san francisco