07.01.2013 Views

Linux i386 Önyükleme Kodu NASIL

Linux i386 Önyükleme Kodu NASIL

Linux i386 Önyükleme Kodu NASIL

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}<br />

<strong>Linux</strong> <strong>i386</strong> <strong>Önyükleme</strong> <strong>Kodu</strong> <strong>NASIL</strong><br />

execve("/bin/sh",argv_init,envp_init);<br />

panic("No init found. Try passing init= option to kernel.");<br />

Kullanıcı kipi "init" süreciyle ilgili bilgiler için man init veya SysVinit (B122) ’e bakınız.<br />

7.3. cpu_idle()<br />

"Idle" süreç:<br />

/*<br />

* Bo¸sta bekleme (idle) evresi. Yapılacak yararlı bir i¸s yok,<br />

* bu yüzden sadece gücü korumaya çalı¸s ve dü¸sük çıkı¸s gecikmesine<br />

* sahip ol (örn. birinin yeniden i¸s yapma iste˘gi<br />

* belirtmesini bekleyen bir döngü içinde kal)<br />

*/<br />

void cpu_idle (void)<br />

{<br />

/* hiç bir önceli˘gi olmayan sonsuz atıl döngü */<br />

init_idle();<br />

current–>nice = 20;<br />

current–>counter = –100;<br />

}<br />

while (1) {<br />

void (*idle)(void) = pm_idle;<br />

if (!idle)<br />

idle = default_idle;<br />

while (!current–>need_resched)<br />

idle();<br />

schedule();<br />

check_pgt_cache();<br />

}<br />

///////////////////////////////////////////////////////////////////////////////<br />

void _ _init init_idle(void)<br />

{<br />

struct schedule_data * sched_data;<br />

sched_data = &aligned_data[smp_processor_id()].schedule_data;<br />

}<br />

if (current != &init_task && task_on_runqueue(current)) {<br />

printk("UGH! (%d:%d) was on the runqueue, removing.\n",<br />

smp_processor_id(), current–>pid);<br />

del_from_runqueue(current);<br />

}<br />

sched_data–>curr = current;<br />

sched_data–>last_schedule = get_cycles();<br />

clear_bit(current–>processor, &wait_init_idle);<br />

///////////////////////////////////////////////////////////////////////////////<br />

void default_idle(void)<br />

{<br />

if (current_cpu_data.hlt_works_ok && !hlt_counter) {<br />

_ _cli();<br />

if (!current–>need_resched)<br />

safe_halt();<br />

http://belgeler.org <strong>Linux</strong> Kitaplı˘gı 50 / 77

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!