1 00:00:00,510 --> 00:00:06,930 You know, structure where we implement our function to actually function is especially important for 2 00:00:06,930 --> 00:00:14,040 us because it means that we can build a program in the host system and a call to our system runs a program 3 00:00:14,040 --> 00:00:17,900 just admitted into operating systems like Windows or Linux. 4 00:00:19,070 --> 00:00:24,390 How do you see in order to run a program in our system, we first focal process. 5 00:00:27,810 --> 00:00:34,740 And a red after we are in the process, we ask you to function to launch a specific program, to ask 6 00:00:34,740 --> 00:00:40,620 you to function, we will search the program with the help of the system on inculpate its instructions 7 00:00:40,620 --> 00:00:42,260 and a data to the USERSPACE. 8 00:00:42,270 --> 00:00:44,450 If we can find the program in the image. 9 00:00:45,300 --> 00:00:51,060 And at this point, the new process, we will be running just as we launched a specific program. 10 00:00:52,050 --> 00:00:54,720 All right, we start off with the user one program. 11 00:00:59,480 --> 00:01:05,950 As you can see, this is a user program in the last way to support we are currently returning from the 12 00:01:05,960 --> 00:01:07,820 work function as a new process. 13 00:01:07,830 --> 00:01:13,010 We're [REMOVED], so we enter if statement instead of printing message. 14 00:01:13,310 --> 00:01:16,190 What we are going to do is we are going to ask you to file. 15 00:01:18,180 --> 00:01:20,160 So we can function as good. 16 00:01:21,230 --> 00:01:26,270 And at this fire will be loaded into your airspace, which means all the code and data here will be 17 00:01:26,270 --> 00:01:29,890 replaced with the instructions and a data of the program, we will ask. 18 00:01:29,980 --> 00:01:32,600 It has not been in this case. 19 00:01:35,500 --> 00:01:40,810 As for the process which started the for cooperation, when it returns from the colonel, it will return 20 00:01:40,810 --> 00:01:44,350 to the part and wait for the new process to allow it. 21 00:01:45,100 --> 00:01:55,570 So here we change the message test process and that after we return from the wavefunction. 22 00:01:56,440 --> 00:02:01,450 So the general structure of the fork and weight operations are still the same as we talked about in 23 00:02:01,450 --> 00:02:02,250 the last structure. 24 00:02:03,820 --> 00:02:05,740 OK, the other part is done. 25 00:02:06,190 --> 00:02:07,810 Next, we move to a torn apart. 26 00:02:10,550 --> 00:02:13,750 So ask you to function is implemented in the process modu. 27 00:02:20,790 --> 00:02:26,790 Here you can see we do ask you to function, which takes two parameters, the current process and the 28 00:02:26,790 --> 00:02:31,170 filename, because we want to load the file in the memory and execute. 29 00:02:31,560 --> 00:02:34,700 We need to open the file on a rate data from it. 30 00:02:35,670 --> 00:02:38,460 So we define larible file, descriptor and size. 31 00:02:39,480 --> 00:02:41,220 Then they open fire on a check. 32 00:02:41,250 --> 00:02:44,990 The reason why do if they open fired, we do nothing. 33 00:02:45,000 --> 00:02:51,360 But as it is a process, otherwise, we initialize the user page with zero because we will copy the 34 00:02:51,360 --> 00:02:58,650 data of a new file to the user space another week as a file size after we get the file size where rates 35 00:02:58,650 --> 00:03:00,090 of our data to the buffer. 36 00:03:00,090 --> 00:03:01,170 Four hundred thousand. 37 00:03:01,740 --> 00:03:03,050 Remember the system. 38 00:03:03,060 --> 00:03:05,210 This is a big surprise of the user space. 39 00:03:06,210 --> 00:03:12,810 If the return value of the rate of file is a maximum value, the operation failed and we simply added 40 00:03:12,810 --> 00:03:13,070 out. 41 00:03:16,100 --> 00:03:18,320 OK, at this point, the data in the U.S. 42 00:03:18,350 --> 00:03:20,390 Space is replaced with this file. 43 00:03:21,820 --> 00:03:23,620 Also, don't forget to close the file. 44 00:03:24,660 --> 00:03:30,540 Since this is not the first time we run the process, we have the user data in the frame when we enter 45 00:03:30,540 --> 00:03:31,230 the Kermode. 46 00:03:32,640 --> 00:03:38,940 What do we want to do in this case is clear the trap frame and studied it, the default state, so we 47 00:03:38,940 --> 00:03:44,730 clear the trap frame and asset to our IP, our ISP, etc. to justify values. 48 00:03:45,750 --> 00:03:50,880 OK, after it is done, when we return to the other mode where we will get to the start of the program 49 00:03:51,150 --> 00:03:53,460 just as we launch the process for the first time. 50 00:03:54,710 --> 00:03:56,250 OK, that's it for the process. 51 00:03:56,270 --> 00:03:56,690 Montreal. 52 00:03:58,860 --> 00:04:00,210 In the sitcom Modu. 53 00:04:05,870 --> 00:04:10,070 We ask obscure function on a function such as cute. 54 00:04:11,160 --> 00:04:18,089 We retrieved the car and process, then we ask it to function and arguments are the process and the 55 00:04:18,089 --> 00:04:20,310 filename we passed from user program. 56 00:04:22,900 --> 00:04:27,230 Changes to checks in the system called function, and we are done to nothing. 57 00:04:27,250 --> 00:04:31,720 We are going to do is we are going to add to obscure function interlibrary. 58 00:04:32,290 --> 00:04:34,120 So interlibrary foder. 59 00:04:36,200 --> 00:04:38,600 We add actual function intercepts commodity. 60 00:04:45,190 --> 00:04:48,120 What defines Adobo as cute? 61 00:04:50,590 --> 00:04:57,380 Since it takes one parameter, we allocate eight by space on a stack, so we subtract out. 62 00:04:58,630 --> 00:05:04,420 So index for the obscure function is 11, so Waymouth, IEX 11. 63 00:05:05,800 --> 00:05:07,750 Then we cop his argument on a stack. 64 00:05:10,270 --> 00:05:17,140 On the move already, I have one indication that we have one argument that we save the price of the 65 00:05:17,140 --> 00:05:19,140 argument in register I sign. 66 00:05:20,440 --> 00:05:22,210 OK, we're into it. 67 00:05:24,330 --> 00:05:31,680 After we return from the colonel, we add our associate to restart Stack and then we simply return. 68 00:05:35,710 --> 00:05:39,220 Global obscure function on the Cisco module is done. 69 00:05:40,170 --> 00:05:45,300 Interlibrary had high profile, we had function as acute. 70 00:05:49,000 --> 00:05:53,020 OK, that's great syllabary file in the terminal. 71 00:05:54,470 --> 00:05:59,240 We go to Laborie Folger, Anderson Poultices Modu. 72 00:06:03,760 --> 00:06:05,860 Then they added in the lab of Rafael. 73 00:06:12,160 --> 00:06:15,850 We copies elaborate a file on the high profile. 74 00:06:18,430 --> 00:06:19,570 To the test folder. 75 00:06:22,870 --> 00:06:24,130 And the use of one, Fauja. 76 00:06:30,010 --> 00:06:36,190 Now, let's create a test that's been filed since, where we'll build a test to use a program, we need 77 00:06:36,190 --> 00:06:43,890 files such as library file to file the start up file Terlingua script and build a script. 78 00:06:44,440 --> 00:06:47,020 So we just copy them from user and product. 79 00:06:55,150 --> 00:06:57,640 In the immediacy of the Transport Act. 80 00:06:59,400 --> 00:07:02,160 But just Pariente test process starts. 81 00:07:03,810 --> 00:07:05,210 And it's up your script. 82 00:07:08,170 --> 00:07:13,210 We specify that the name of the to file is test not being. 83 00:07:14,550 --> 00:07:16,940 OK, all the files all prepared. 84 00:07:18,190 --> 00:07:22,000 That's both a test product, use a product on a product. 85 00:07:30,970 --> 00:07:33,910 OK, let's move to offset the image. 86 00:07:46,630 --> 00:07:48,320 Copies of test being file. 87 00:07:56,950 --> 00:07:58,480 So, Colonel, meanwhile. 88 00:08:05,990 --> 00:08:07,400 And a user tarping file. 89 00:08:16,490 --> 00:08:18,530 With this month's deportation. 90 00:08:20,940 --> 00:08:22,170 On the rent, a postscript. 91 00:08:30,560 --> 00:08:34,760 As you can see, test process starts on a test process access. 92 00:08:35,760 --> 00:08:38,940 You'll see it's a test process is running great. 93 00:08:39,000 --> 00:08:41,850 We are running the program in our operating system.