‫Hello and welcome, everybody, in this lecture.
‫We are going to use the functionality we created in the last lecture, I saw Eddie Heydrich to command,
‫for example, and I saw a channel command.
‫We're going to use this functionality to create our very first colonel command.
‫Now, first things first.
‫We want something separate.
‫We don't want spam.
‫All of the commands inside of the Iditarod.
‫See, that's going to get very messy.
‫So in our source directory, we're going to create a new directory and we're going to call it Isaw 88.
‫OK, so that'll be in a directory of its own.
‫Inside here, we're going to create a new file called ISO eighty page dot org.
‫So the the H here stands for hexadecimal, by the way.
‫So what we're going to do now is we're going to go if and Def Izadi each page, define ISI d.H page
‫and just get rid of that.
‫There was a mistake so it should look like that, OK.
‫And in here we're going to go void Izadi 8H register commands and this function will be responsible
‫for registering all of the ISI, the commands.
‫When I'm going to create a new file called ISI d.H Dot C, we're going to include IASA H.R.H. and we're
‫going to include ADT I t dot org when I going to go void isi d.h register commands.
‫OK, perfect.
‫So this will be where the register commands done.
‫If you check the presentation in a couple of lectures behind, you'll see that, but we're going to
‫implement that now anyway.
‫We're going to call the ISO eighty register command function here.
‫And Reg, just some example commands for ourselves.
‫OK, so we're going to create a new file in here called Mr. Hage.
‫If and ISI d.H Misk underscore the fine ISI 8h misc underscore HYG and if we're going to have a function
‫here.
‫So it's going to have to return the pointer.
‫We're going to say Isaw 8H command a zero and we'll just going to call it some.
‫OK, and again this will accept a interrupt frame.
‫OK, I think that was the prototype.
‫Let's double check that.
‫I see, I see that scroll up.
‫Yes.
‫So we can see ISI.
‫The command should look like this.
‫OK, so it accepts an interim frame and returns a viewpoint.
‫Perfect.
‫So.
‫In here, we're just going to go struct Entropa frame, just forward, declare that we're going to copy
‫and paste this prototype.
‫Now we'll create a new file Combest of C and we're going to include most of the Hajj and we're going
‫to paste that in there.
‫And we're just going to return zero here.
‫OK, so you can see what we've done here, right?
‫We're creating a.
‫Function a COL function with the command ID of zero.
‫We've just named it like this because it's clean, it's clear what's going on.
‫This is Command Zero.
‫It's responsible for something.
‫Two numbers together.
‫Now, this is just an example.
‫Command on.
‫You would never have a command in the kernel for something to function.
‫That's crazy.
‫But this is kind of like your Hello World introduction, if you will.
‫So this this doesn't fit anywhere, which is why we've called it Maersk.
‫OK, so all the miscellaneous commands will be going into the Stazi file.
‫OK, so this function here, ISSI, the commands zero sum is miscellaneous.
‫So it goes here.
‫OK, and now we also need to include ADT DOT Hajj as well inside this C file, OK.
‫So this one forward declares that this one includes that, OK, we have zero here.
‫This is what's passed back to the U.S., the land, the userspace, OK?
‫OK, so what we're now going to do is we're going to go to Isaw aid agency and we're just going to go
‫inside the register command, it's going to ask for command ID.
‫We don't have the command ID yet.
‫So what do we do?
‫We go to ISI, the Hajj, the Hajj, and we're just going to go Inam system commands.
‫And we're going to go system command.
‫Zero sum.
‫OK, so this command here will be responsible for something.
‫And we can just make a giant list, a system command prince and so on, but we'll just have some for
‫now.
‫OK, so we could easily start see, we can see it's asking for that.
‫So we're going to go system command zero sum.
‫I was going to ask for the command.
‫Well, we need to include the miscellaneous file to do that.
‫So just include Mr. Hatch and the command will be ISI d.H Command Zero sum and that binds that command.
‫The command would with the idea of zero.
‫It binds it to this function here.
‫ISAF command zero sum.
‫So we click here.
‫ISAF Command Control click control left click.
‫You'll see, you'll see.
‫That sets the index in the array.
‫OK, so when we come around to handle this, you'll see the command will be zero.
‫So it will access the zero zero index from this ISI commands array.
‫It will then have the function pointed to that command and it will call that function through the function
‫pointer.
‫Now, this will end up with this function being called because we binded it here by registering the
‫command with system command some which is equal to zero, command zero, and we binded it with the function
‫here.
‫So that's how that's working.
‫OK, so if you still don't understand that, please let me know if you understand function pointis and
‫C, you should be able to grasp that idea rather easily.
‫OK, so let's just see if everything compiles before we continue any further.
‫So we need to just go to the build directory here.
‫Wheen's create a new folder and we're just going to call it Isaw 8H, OK, and I'm going to create a
‫dot.
‫Keep filing here because I'm using git repository.
‫You guys don't have to do that if you don't want to.
‫Just a simple dot keep file and we're going to go to the makefile now, OK?
‫And we're going to copy and paste a C file any C file.
‫We'll copy and paste this one here.
‫I'm going to copy and paste it and we're going to change the bill.
‫T It's isolating the object to be called inside.
‫The source directory will be isolated and we'll be compiling.
‫I decided not see the include here will be ISI d.H.
‫The file were compiling will be ISI to see inside the ISI, the directory and will be outputting that
‫file to ISI, the ISI to start over.
‫OK.
‫So now just copy and paste this entire declaration because we need to also compile the misc file.
‫So we're going to change this to Mr.
‫Oh so that's the directory.
‫That's the file.
‫Mysterio This can say the same because it shows the same directory.
‫We're going to change this to Mr. C and we're going to change this to oh, we're going to change.
‫This semester at sea, OK?
‫So we're going to copy and paste this bill file and we're going to put it at the top here.
‫It can go anywhere in that files or files label and we're going to go down here, we're going to copy
‫and paste the Misc.
‫And I was just going to go make a clean bill that S.H..
‫And we can see that Bill is absolutely fine, and if we take a look in the bill, we can see the object
‫files now in there.
‫So, OK, we've now successfully registered that command, although we also need to actually call saw
‫80 register commands, which we haven't done yet.
‫So we're going to add that and then that will conclude this lecture.
‫OK, so if we just go to Colonel Darcy, we're going to scroll up and we're going to include.
‫I saw Eddie.
‫I saw Eddie that hedge, OK?
‫And we scroll down in our Curnoe.
‫After we've been able paging we're going to we're going to load all of those commands, so we're just
‫going to go inside the register commands, register the colonel commands, OK, let's just make clean
‫that now and build again.
‫Can see that work, said Ben Kumu, OK, the command is out of bounds, that's why we test things so
‫they come up the commands is out of bounds.
‫Let's find out why.
‫If we go to airside commands and we left click to go to register command.
‫I look at that is the command below or equal to zero?
‫That's the bug right there, guys, that should be below zero.
‫OK, and also change.
‫If I handle command, it should be below zero.
‫Not below are equal because a command can be zero.
‫We're absolutely fine with that.
‫OK, because indexes can be zero.
‫So that's completely OK.
‫Only if it's below zero.
‫There's a problem.
‫So make sure you fix that little mistake that I did that.
‫So we're going to go make a clean bill to the S.H..
‫Citibank, WAMU, and now we see everything is as expected.
‫OK, thanks for watching.
‫And in the next lecture, we will actually change our program so that it talks with our little function
‫that we made for the colonel here.