‫Hello, we're now going to create an exit command, so currently if we go to Blanchot, see it, we'll
‫see.
‫We need a while loop.
‫Now, the reason we need that is because we don't have an exact command.
‫So what's going to happen is it's going to return until the program crashes.
‫And that's no good.
‫No one likes that.
‫Right.
‫So we're going to create an exit command today, which will gracefully terminate the program.
‫So, yeah, that's what we're going to do.
‫So let's head over to ISI and the colonel and we're going to create a exit command.
‫OK, head over the process, start see here and we're going to say Void Izadi Hajj Command nine, exit
‫struct in your frame frame and you can also use command zero if you want.
‫We may day some in here for that, but you can replace that with this if you want with the exit command.
‫So here we're going to go through the process.
‫Process equals task current process and we're just going to say process, terminate process, OK, and
‫now we're just going to go test next, which, as you know, we'll start the next task.
‫So that's our exit command is very simple.
‫Now, in a better implementation, we could take some sort of exit code and ensure that the process
‫that's blocking on us, the one that's started our process, gets told about the error code or all the
‫success code that was written a little like in command when it says it's returned status five or stuff
‫like that.
‫Right.
‫Or when there's a problem in the Linux terminal, if you return a negative value, it tells you the
‫negative value that was returned.
‫You could take that a step further.
‫We're not going to do that here.
‫But yes, you can take it a step further and you can channel you can channel that error code or success
‫code back to the process that started you in the first place.
‫So we're going to copy and paste this into process, start Hajj just so we have the placeholder code,
‫Asadi Hajj, and we're going to register the command.
‫OK, so we're going to go I Assadi Hajj Register Command System Command nine exit.
‫And obviously we don't have that command code yet.
‫We will make that and find that to Izadi Command, 9x it and we're going to go to our society Hajj that
‫Hajj and we're just going to go system command nine exit just like that.
‫OK, and there we are.
‫That'll never work.
‫So go back to process, see.
‫And I say the Hajj we can see that looks absolutely fine.
‫So the next step then is to go to the standard library for the user program and we're going to go to
‫PTW Judaism and we're going to implement the user land version of Exit that evokes the kernel.
‫So we're going to go Void Peatross exit and that's just going to look like this and we're going to go
‫PRUs GBP.
‫Move E.S.P to SBP, move x nine, come on, nine, process exit first these words, oh no, we have
‫nothing to push this time in a decade to invoke the colonel and we're just going to pop the base point
‫and return.
‫So it's as simple as that, guys.
‫OK, we're going to scroll all the way up now and we're going to go global peatross exit function.
‫OK, scroll all the way down and we're going to copy and paste this prototype here and we're going to
‫copy and paste it in PTW Hajj.
‫OK, just like that.
‫Perfect.
‫Uh, that's really good.
‫So what we're now going to do, we're going to go to blank, see, we're going to get rid of our while
‫loop so that we actually return OK.
‫And inside start Dadaism, uh, we're literally just going to go here and we're going to say call Peatross
‫exit, OK?
‫And we're going to go extern Process said.
‫And that should work, guys, because we call seastar, which calls us Stazi file, which calls our
‫main function, which then returns and then start today.
‫And then we call Peatross Exit, which kills our program.
‫So let's try that then, uh, just get rid of this error that this deliberate problem that we made here
‫where we tried to set zero zero zero to zero fifty seven to that.
‫So there's no bug in the program and we're going to go make clean bill that S.H. Uh, we can see it
‫says control reaches end of non-voice function.
‫OK, so just go to A.S.A. again and process Stazi and we're just going to return zero here.
‫I was a minor little mistake I made.
‫We can try that again.
‫We can see everything works fine.
‫So we're going to go CDB and we're going to run Kumu System I 386 HDA, uh, dash Hajja stop in and
‫we're just going to go blank that out.
‫Testing A, B, C, we can see that it outputs, testing A, B, C and then it kills our program gracefully
‫kills it.
‫So that's perfect guys.
‫So we're able to run programs through our show and have control returned to us, if that's not operating
‫system, I don't know what is so well done.
‫You're now able to exit out of your programs.