from Transistors to CPU
8:36
3 ай бұрын
How functions work in asm
8:39
4 ай бұрын
why stack exists
4:54
6 ай бұрын
Do you trust the compiler?
3:05
7 ай бұрын
How breakpoints work
2:18
7 ай бұрын
Reinventing the Processor
10:02
7 ай бұрын
Пікірлер
@stdint.h
@stdint.h 3 күн бұрын
Good video.
@Artoooooor
@Artoooooor 5 күн бұрын
Thanks for the vid
@preetishamballi6988
@preetishamballi6988 5 күн бұрын
Excellent video. Only missing thing was, If there are multiple threads in process, how kernel will identify which thread to interrupt. Is it the one which raises system call first?
@jonwood6662
@jonwood6662 9 күн бұрын
Please please tell me what VS code theme this is? So easy on the eyes
@kimylamp
@kimylamp 9 күн бұрын
Sure. It's Gruvbox Dark Medium.
@vicsteiner
@vicsteiner 9 күн бұрын
I'm learning a lot from your channel. Not sure if it's the right place to ask but do you have any recommendations on where to start learning assembly for a beginner that does have knowledge in C? There are so many options that I simply do not know where to start.
@LHCB6
@LHCB6 10 күн бұрын
I heard the intro as: At some point, we want our problems to communicate with other problems.
@dza1988
@dza1988 11 күн бұрын
This videos are gold
@samor9155
@samor9155 12 күн бұрын
I like that you described it as for people who already know something, but don't know how interrupts work, so it doesn't start by explaining how assembly works. Great video, I learned a lot.
@svensimon
@svensimon 10 күн бұрын
exactly my level and much appreciated, yes
@33550336100
@33550336100 13 күн бұрын
@kimylamp Nice work showing the kernel source code to track the signal handler implementation. But you missed something. printf is not signal safe, at all. For a list of detailed signal-safe system calls (write is not one of them), go to man7 signal-safety(7)
@ricardomarliere
@ricardomarliere 13 күн бұрын
Thank you for this! Very informative.
@haiphamle3582
@haiphamle3582 13 күн бұрын
Excellent content as always. Thank you for delivering this. But I would love to have more detail on that special stack, using for storing return function addresses. Anyway, many thanks!
@haiphamle3582
@haiphamle3582 14 күн бұрын
Excellent content! I hope your channel receiving more attention.
@tennicktenstyl
@tennicktenstyl 14 күн бұрын
this edit goes so hard 🔥
@spicy_wizard
@spicy_wizard 15 күн бұрын
from manpage: sigreturn() exists only to allow the implementation of signal handlers.
@luciusstark
@luciusstark 17 күн бұрын
What do you use to make these effects?
@dohyun0047
@dohyun0047 19 күн бұрын
this video is awesome, but i guess my background is not good enough to fully appreciate it .. ㅜㅜㅜㅜㅜㅜㅜㅜㅜㅜ
@mouhamedbourouba3637
@mouhamedbourouba3637 19 күн бұрын
ty so much for explanation !!!!
@webmilio
@webmilio 20 күн бұрын
Swear to god I can hear the clock in the background
@OlliS71
@OlliS71 20 күн бұрын
Signals are a total misconception.
@Akesss
@Akesss 21 күн бұрын
Thank you! The best
@cheesybrik9073
@cheesybrik9073 21 күн бұрын
Hey don’t use ai. There are plenty of willing artists out there that deserved to be payed. AI relies on the un-consenting use of artist’s work for training.
@whyareyoulookingatthislol
@whyareyoulookingatthislol 22 күн бұрын
i still gotta watch this video but it might be cool for you to make something about the device model
@Meaticus22
@Meaticus22 22 күн бұрын
dotfiles please
@samhughes1747
@samhughes1747 24 күн бұрын
Dude. I'm a tad jaded, and generally expect unfamiliar youtubers to be a bit sheit. It's background noise and an occasional interesting idea for me. You full on stole my attention and kept me from getting anything done! Good stuff, my dude!
@torphedo6286
@torphedo6286 24 күн бұрын
Wow, inserting an extra syscall trampoline like that is really clever. it was all very normal up to that point, but I don't think I'd ever have thought of that (or I'd write it off as an insane hack that would probably break).
@caballerosalas
@caballerosalas 24 күн бұрын
Hi @kimylamp, can I ask you which software do you use to make the animation of your videos?
@saaah707
@saaah707 28 күн бұрын
What a time to be alive, when videos like this exist
@ahmoin
@ahmoin 16 күн бұрын
two minute papers
@arminveres850
@arminveres850 28 күн бұрын
What is the colorscheme in VSCode?
@schnauzerofdoom8819
@schnauzerofdoom8819 28 күн бұрын
No wonder it took you years to figure this out, wtf. All this time using a pattern I thought was relatively straight forward, and it turns out the nitty gritty of how signals are actually sent is confusing as hell.
@user-zt2lp6hq7l
@user-zt2lp6hq7l 28 күн бұрын
man this is complicated
@GerbenWijnja
@GerbenWijnja 29 күн бұрын
5:24 "now I will mark the ...?... process" what are you saying there?
@luciusstark
@luciusstark 17 күн бұрын
"now I will mark the busyloop process"
@juanguillermoalarcon447
@juanguillermoalarcon447 Ай бұрын
Great video! How do you make these animations? 01:24
@juanmamani2110
@juanmamani2110 Ай бұрын
flash back programming interrupts in 80's ! aaaah hardware interrupts and software interrupts... ..
@julkiewicz
@julkiewicz Ай бұрын
I've been taught not to use printf inside a signal handler
@ruili1984
@ruili1984 Ай бұрын
Very useful content. Thank you!
@nonameavailableatm
@nonameavailableatm Ай бұрын
Still too complicated for me
@m19v
@m19v Ай бұрын
Great content! Can you please share what tools do you use for animations?
@AaronFullerMusic
@AaronFullerMusic Ай бұрын
Your videos are incredible. Thank you for breaking those topics down into such an understandable form.
@dprophecyguy
@dprophecyguy Ай бұрын
# Signals Cheat Sheet ## Signal Handling Mechanism 1. Program registers a signal handler for a specific signal using the `signal` system call. 2. Another process sends the signal to the program using the `kill` system call. 3. Kernel marks the program with a "signal pending" flag. 4. When the program jumps to kernel code (interrupt, exception, or system call), the kernel checks the "signal pending" flag. 5. If the flag is set, the kernel replaces the program's saved program counter with the address of the registered signal handler. 6. The kernel resumes the program, which now jumps to the signal handler instead of the original code. ## Interrupt Handling in ARM64 - CPU jumps to the interrupt handler address stored in the `VBAR_EL1` register. - Kernel saves all user registers to memory in a `pt_regs` structure. - Kernel handles the interrupt and checks for pending signals. - If a signal is pending, the kernel replaces the saved program counter in `pt_regs` with the signal handler address. - Kernel restores registers from `pt_regs` and jumps back to the signal handler. ## Signal Handler Execution - Signal handler code executes using the user stack. - Original register values are saved on the user stack before executing the signal handler. - When the signal handler finishes, it jumps to a trampoline code using the `ret` instruction. - Trampoline code invokes the `rt_sigreturn` system call to restore the original register values. - Kernel restores the original register values from the user stack and resumes the program from where it was interrupted. ## Code Examples ### Registering a Signal Handler ```c #include <signal.h> void signal_handler(int signum) { // Signal handling code } int main() { signal(SIGUSR1, signal_handler); // Rest of the program } ``` ### Sending a Signal ```c #include <signal.h> int main() { pid_t pid = /* Get the target process ID */; kill(pid, SIGUSR1); } ``` ### Trampoline Code (Assembly) ```assembly rt_sigreturn_trampoline: mov x8, #__NR_rt_sigreturn svc 0 ``` ## Important Points - Signals can arrive at any moment during program execution. - The kernel saves the original register values on the user stack before executing the signal handler. - Local variables stored beyond the stack pointer may be overwritten by the kernel when saving registers or executing the signal handler. - Nested signals are handled by saving register values on the user stack to avoid overflowing the kernel stack. This cheat sheet provides an overview of the signal handling mechanism, interrupt handling in ARM64, and the execution flow of signal handlers. It also includes code examples for registering a signal handler, sending a signal, and the trampoline code used to restore the original register values after the signal handler finishes.
@FFAMax1
@FFAMax1 Ай бұрын
Man, thanks, it’s good but not for mobile screens
@kammamixoccam9485
@kammamixoccam9485 Ай бұрын
a very good explanation and hard work , good animation , keep going
@joaovictorfernandes1656
@joaovictorfernandes1656 Ай бұрын
This is such a great video! thank you
@marcossneijder
@marcossneijder Ай бұрын
Fantastic ... finally someone that explained assembly in an easy to understand way!
@Ic3q4
@Ic3q4 Ай бұрын
really good video ngl
@Ipadstands
@Ipadstands Ай бұрын
Beautiful Description
@nicknick8884
@nicknick8884 Ай бұрын
Дякую!
@dagmtz
@dagmtz Ай бұрын
Hello! I’m teaching a class in embedded systems and I like you explanation a lot, so I want to explain the stack concept in the way you do but in spanish. Is it okay if I use the structure and information you give here to create some slides for my class? :)
@kimylamp
@kimylamp Ай бұрын
Hi! Sure, why not. Thanks!
@dagmtz
@dagmtz Ай бұрын
@@kimylamp thanks to you! :)
@Ab_Irato
@Ab_Irato Ай бұрын
The layout is just beautiful and the instructions are crystal clear.
@JamesSjaalman
@JamesSjaalman Ай бұрын
Bad example. You CANNOT call printf() from within a signal handler. printf is not async-safe [it may call malloc() internally while interrupting inside of malloc()]
@deathdefier45
@deathdefier45 Ай бұрын
Learnt more C and Assembly than I did in 4 years of college in 21 minutes, you're a legendary instructor mate thank you for your service ❤