* can anyone tell me which function to call to pause the kernel
@ 2016-05-12 14:55 walkerlala
2016-05-12 15:26 ` François
2016-05-15 17:36 ` Mulyadi Santosa
0 siblings, 2 replies; 7+ messages in thread
From: walkerlala @ 2016-05-12 14:55 UTC (permalink / raw)
To: kernelnewbies
I successfully insert some function into the kernel code and make it
execute when the kernel start up, but I just can't make the kernel stop
executing. Are there any functions which can pause the kernel so that I
prompt the user, and let the user input a command(maybe a comment to
display the current time. Something like a shell would do) and interact ?
(I had checked the "sys_***" functions in this page:
http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html
but just can't find a proper one )
^ permalink raw reply [flat|nested] 7+ messages in thread* can anyone tell me which function to call to pause the kernel 2016-05-12 14:55 can anyone tell me which function to call to pause the kernel walkerlala @ 2016-05-12 15:26 ` François 2016-05-15 17:36 ` Mulyadi Santosa 1 sibling, 0 replies; 7+ messages in thread From: François @ 2016-05-12 15:26 UTC (permalink / raw) To: kernelnewbies On 05/12/2016 04:55 PM, walkerlala wrote: > I successfully insert some function into the kernel code and make it > execute when the kernel start up, but I just can't make the kernel stop > executing. Are there any functions which can pause the kernel so that I > prompt the user, and let the user input a command(maybe a comment to > display the current time. Something like a shell would do) and interact ? I don't think you can actually stop the kernel. The linux kernel is multi-threads and events driven, so I doubt you can stop and restart it that easily. BUT if you want to interract with userland, you can implement a syscall on your own, or create a proc device (for instance) to let user read / write data to the kernel. For instance, you could create a proc entry called gettime, and when user reads it (ie: cat /proc/gettime) you would provide a proper answer. Hope this help. Fran?ois ^ permalink raw reply [flat|nested] 7+ messages in thread
* can anyone tell me which function to call to pause the kernel 2016-05-12 14:55 can anyone tell me which function to call to pause the kernel walkerlala 2016-05-12 15:26 ` François @ 2016-05-15 17:36 ` Mulyadi Santosa [not found] ` <57391618.7090506@gmail.com> 1 sibling, 1 reply; 7+ messages in thread From: Mulyadi Santosa @ 2016-05-15 17:36 UTC (permalink / raw) To: kernelnewbies On Thu, May 12, 2016 at 9:55 PM, walkerlala <ablacktshirt@gmail.com> wrote: > I successfully insert some function into the kernel code and make it > execute when the kernel start up, but I just can't make the kernel stop > executing. Are there any functions which can pause the kernel so that I > prompt the user, and let the user input a command(maybe a comment to > display the current time. Something like a shell would do) and interact ? > (I had checked the "sys_***" functions in this page: > http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html > but just can't find a proper one ) > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > Hi... sounds like what kgdb does. But not sure if it is still maintained or not. btw, kernel can not be paused, actually. if you really need that, you need to run linux kernel inside virtual machine and pause the virtual machine. But doing that, you will also pause user space too :) -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160516/04028e87/attachment.html ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <57391618.7090506@gmail.com>]
* can anyone tell me which function to call to pause the kernel [not found] ` <57391618.7090506@gmail.com> @ 2016-05-17 11:41 ` Mulyadi Santosa 2016-05-17 12:29 ` walkerlala 0 siblings, 1 reply; 7+ messages in thread From: Mulyadi Santosa @ 2016-05-17 11:41 UTC (permalink / raw) To: kernelnewbies On Mon, May 16, 2016 at 7:36 AM, walkerlala <ablacktshirt@gmail.com> wrote: > On 2016?05?16? 01:36, Mulyadi Santosa wrote: > >> >> >> On Thu, May 12, 2016 at 9:55 PM, walkerlala <ablacktshirt@gmail.com >> <mailto:ablacktshirt@gmail.com>> wrote: >> >> I successfully insert some function into the kernel code and make it >> execute when the kernel start up, but I just can't make the kernel >> stop >> executing. Are there any functions which can pause the kernel so that >> I >> prompt the user, and let the user input a command(maybe a comment to >> display the current time. Something like a shell would do) and >> interact ? >> (I had checked the "sys_***" functions in this page: >> http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html >> but just can't find a proper one ) >> >> _______________________________________________ >> Kernelnewbies mailing list >> Kernelnewbies at kernelnewbies.org <mailto: >> Kernelnewbies at kernelnewbies.org> >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies >> >> >> Hi... >> >> sounds like what kgdb does. But not sure if it is still maintained or not. >> >> btw, kernel can not be paused, actually. if you really need that, you >> need to run linux kernel inside virtual machine and pause the virtual >> machine. But doing that, you will also pause user space too :) >> >> -- >> regards, >> >> Mulyadi Santosa >> Freelance Linux trainer and consultant >> >> blog: the-hydra.blogspot.com <http://the-hydra.blogspot.com> >> training: mulyaditraining.blogspot.com < >> http://mulyaditraining.blogspot.com> >> > > Hi, thanks for reply. > > I know using a debugger or virtual machine would help a little bit, but > that's not interactive any more. What I want is just a shell-like > "interactive" kernel (may be I am a little naive to think that ?) > > Why the kernel cannot be stopped ? I think, now that if the kernel can be > interrupted, then why can't it be stopped by some mechanisms ? > > Regards, > > Hi... please add kernelnewbies to cc: list too next time :) Kernel can't be stopped, because it's actually servicing event mostly generated by hardware (interrupts etc) or user space (syscall etc). So unless you stop these two aspects to raise events, basically kernel will still do its works. -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160517/cd6b9579/attachment.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* can anyone tell me which function to call to pause the kernel 2016-05-17 11:41 ` Mulyadi Santosa @ 2016-05-17 12:29 ` walkerlala 2016-05-17 15:21 ` Valdis.Kletnieks at vt.edu 0 siblings, 1 reply; 7+ messages in thread From: walkerlala @ 2016-05-17 12:29 UTC (permalink / raw) To: kernelnewbies On 2016?05?17? 19:41, Mulyadi Santosa wrote: > > > On Mon, May 16, 2016 at 7:36 AM, walkerlala <ablacktshirt@gmail.com > <mailto:ablacktshirt@gmail.com>> wrote: > > On 2016?05?16? 01:36, Mulyadi Santosa wrote: > > > > On Thu, May 12, 2016 at 9:55 PM, walkerlala > <ablacktshirt at gmail.com <mailto:ablacktshirt@gmail.com> > <mailto:ablacktshirt at gmail.com <mailto:ablacktshirt@gmail.com>>> > wrote: > > I successfully insert some function into the kernel code > and make it > execute when the kernel start up, but I just can't make the > kernel stop > executing. Are there any functions which can pause the > kernel so that I > prompt the user, and let the user input a command(maybe a > comment to > display the current time. Something like a shell would do) and > interact ? > (I had checked the "sys_***" functions in this page: > http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html > but just can't find a proper one ) > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies at kernelnewbies.org > <mailto:Kernelnewbies@kernelnewbies.org> > <mailto:Kernelnewbies@kernelnewbies.org > <mailto:Kernelnewbies@kernelnewbies.org>> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > > > Hi... > > sounds like what kgdb does. But not sure if it is still > maintained or not. > > btw, kernel can not be paused, actually. if you really need > that, you > need to run linux kernel inside virtual machine and pause the > virtual > machine. But doing that, you will also pause user space too :) > > -- > regards, > > Mulyadi Santosa > Freelance Linux trainer and consultant > > blog: the-hydra.blogspot.com <http://the-hydra.blogspot.com> > <http://the-hydra.blogspot.com> > training: mulyaditraining.blogspot.com > <http://mulyaditraining.blogspot.com> > <http://mulyaditraining.blogspot.com> > > > Hi, thanks for reply. > > I know using a debugger or virtual machine would help a little bit, > but that's not interactive any more. What I want is just a > shell-like "interactive" kernel (may be I am a little naive to think > that ?) > > Why the kernel cannot be stopped ? I think, now that if the kernel > can be interrupted, then why can't it be stopped by some mechanisms ? > > Regards, > > > > Hi... > > please add kernelnewbies to cc: list too next time :) > > Kernel can't be stopped, because it's actually servicing event mostly > generated by hardware (interrupts etc) or user space (syscall etc). So > unless you stop these two aspects to raise events, basically kernel will > still do its works. > > > -- > regards, > > Mulyadi Santosa > Freelance Linux trainer and consultant > > blog: the-hydra.blogspot.com <http://the-hydra.blogspot.com> > training: mulyaditraining.blogspot.com <http://mulyaditraining.blogspot.com> Can I just disable interrupts from hardwares? I know that, at the very beginning, the kernel disable interrupt for convenient. So I wonder whether we can do thing like this. Put it in another way: when we "interact" with a Linux Desktop, there are also many programs running underneath as daemons, but we can still do our own works without even noting their existing. So I wonder, is there a similar way that we can use to interact with the kernel (without using a debugger) ? If there is, can you any one show me some examples ? Thanks in advance Regards, ^ permalink raw reply [flat|nested] 7+ messages in thread
* can anyone tell me which function to call to pause the kernel 2016-05-17 12:29 ` walkerlala @ 2016-05-17 15:21 ` Valdis.Kletnieks at vt.edu 2016-05-18 4:53 ` walkerlala 0 siblings, 1 reply; 7+ messages in thread From: Valdis.Kletnieks at vt.edu @ 2016-05-17 15:21 UTC (permalink / raw) To: kernelnewbies On Tue, 17 May 2016 20:29:12 +0800, walkerlala said: > Can I just disable interrupts from hardwares? I know that, at the very > beginning, the kernel disable interrupt for convenient. So I wonder > whether we can do thing like this. Sure you can do that. But then, how do you get the kernel's attention? > > Put it in another way: > when we "interact" with a Linux Desktop, there are also many programs > running underneath as daemons, but we can still do our own works without > even noting their existing. So I wonder, is there a similar way that we > can use to interact with the kernel (without using a debugger) ? Try this: Start up Xorg and your preferred window manager. Open an xterm or a Gnome-terminal or whatever. >From that window, try to attach gdb to the Xorg process: % ps ax|grep Xorg 1791 tty2 S+ 69:42 /usr/libexec/Xorg vt2 -displayfd 3 -auth /run/user/967/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty -verbose 3 62036 pts/0 S+ 0:00 grep Xorg % gdb -p 1791 What happens? Why does it happen? Eventually, you'll figure out what Xorg and the kernel have in common here.... -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 848 bytes Desc: not available Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160517/3c2a6a7a/attachment.bin ^ permalink raw reply [flat|nested] 7+ messages in thread
* can anyone tell me which function to call to pause the kernel 2016-05-17 15:21 ` Valdis.Kletnieks at vt.edu @ 2016-05-18 4:53 ` walkerlala 0 siblings, 0 replies; 7+ messages in thread From: walkerlala @ 2016-05-18 4:53 UTC (permalink / raw) To: kernelnewbies On 2016?05?17? 23:21, Valdis.Kletnieks at vt.edu wrote: > On Tue, 17 May 2016 20:29:12 +0800, walkerlala said: > >> Can I just disable interrupts from hardwares? I know that, at the very >> beginning, the kernel disable interrupt for convenient. So I wonder >> whether we can do thing like this. > > Sure you can do that. > > But then, how do you get the kernel's attention? > >> >> Put it in another way: >> when we "interact" with a Linux Desktop, there are also many programs >> running underneath as daemons, but we can still do our own works without >> even noting their existing. So I wonder, is there a similar way that we >> can use to interact with the kernel (without using a debugger) ? > > Try this: > > Start up Xorg and your preferred window manager. > > Open an xterm or a Gnome-terminal or whatever. > > From that window, try to attach gdb to the Xorg process: > > % ps ax|grep Xorg > 1791 tty2 S+ 69:42 /usr/libexec/Xorg vt2 -displayfd 3 -auth /run/user/967/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty -verbose 3 > 62036 pts/0 S+ 0:00 grep Xorg > % gdb -p 1791 > > What happens? > > Why does it happen? > > Eventually, you'll figure out what Xorg and the kernel have in common here.... > Ok after trying what you said, I think I understand what you mean eventually. I try to use gdb to attach the window manager, which happen to be Compiz on my machine, then the whole GUI block. The only thing that I can see being able to react is the cursor(honestly I don't understand why the cursor can move....) This is my reasoning: when I attach gdb to Compiz, the window manager block, thus not being able to serving. The same with the kernel. If I block the kernel, then it would not be able to serve..... Is this what you mean ? So I have to wait for the kernel to finish and prompt me a console ? Actually, I am willing to do so, but I just can't get the raw kernel to run at Qemu. That is the reason why I tried to block the kernel...... Any idea ? Regards, ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-05-18 4:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-12 14:55 can anyone tell me which function to call to pause the kernel walkerlala
2016-05-12 15:26 ` François
2016-05-15 17:36 ` Mulyadi Santosa
[not found] ` <57391618.7090506@gmail.com>
2016-05-17 11:41 ` Mulyadi Santosa
2016-05-17 12:29 ` walkerlala
2016-05-17 15:21 ` Valdis.Kletnieks at vt.edu
2016-05-18 4:53 ` walkerlala
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).