Pintos project2 argument passing12/28/2023 ![]() ![]() ![]() Feel free to reply to this thread for any comments, questions or doubts. I haven't given complete details of How this needs to be done which I think you should try before asking some body. Push the value of argc then finally push a fake return point may be NULL. Then push the address of the stack position which contains the address of the string "echo\0", starred in the previous line. There-after push the addresses the strings on the stack just passed again in the same order. Then push a NULL pointer sentinal of type "uint32_t" corresponding to argv In order to make the esp pointer a multiple of 4 You need to remember the addresses on the stack where these strings are being pushed as u later to need to push these addresses as well. Push all the arguments onto the stack in reverse order. Insert your code after the page is successfully installed i.e inside The basic C library for user programs tries to read argv off the stack. Then your work is to set up the stack which is done in the function setup_stack called in the line 305. This will happen if you havent implemented argument passing (or havent done so correctly). So that the correct program file will be opened since passing will cause an error as there won't be any such program file. The only thing is that instead of this argument, a pointer pointing to this string should be passed. You may want to look at the functions present in "lib/string.c" on how this can be done or create your own function to do this. Inside load is where you need to do the modifications.įirstly since the argument file_name_which is passed points to the string, You need to get the name of the user program which needs to loaded which in this case is 'echo'. Start_process creates the interrupt frame and goes on to load the user program and then run it. Process_execute() creates a new thread passing 'start_process' as the function to be performed whose task is to load this user program and the string is passed as well. Run task calls 'process_execute' located in 'userprog/process.c' with the pointer to this string. This leads to the calling of the function "run_task" (due to the argument run) with the argument argv which now points to the string. "run", which is nothing but a command which says run the program 'echo' with the arguments 'x' and 'y'. Run_actions determines what task needs to be done by using the first string available here i.e. User programs run in user mode and when a critical resource or service is. " run echo x y " which is passed as a pointer named "argv" The PintOS user process model and the system call API are modeled after. ![]() Main then calls run_actions with the following argument In the parse_options function appropriate flags are set indicating that the option has been acknowledged and that the PINTOS will be turned off once the task is completed.Īll the arguments which are pintos options will get parsed in this function. "-q"> this is just a pintos option for powering off the system once the processing is done. This causes the parsing of the arguments like this Running a typical User program involves issuing the following command This is done in the file "threads/init.c" in the 'main' function. Just like in a regular command line argument passing, Pintos already does the parsing of the arguments passed to it via command line. 먼저 시스템 콜 핸들러에 dup2함수를 추가한다.A brief intro to argument passing in Pintos GRADING_FILE = $(SRCDIR)/tests/userprog/Grading.extra # Uncomment the lines below to submit/test extra for project 2. GRADING_FILE = $(SRCDIR)/tests/userprog/Grading.no-extra TEST_SUBDIRS = tests/userprog tests/filesys/base tests/userprog/no-vm tests/threads KERNEL_SUBDIRS += devices lib lib/kernel userprog filesys KERNEL_SUBDIRS = threads tests/threads tests/threads/mlfqs PintOS | Project 2 | 시스템콜 구현 (fork, wait, read, write, seek, tell, close) ![]() IntOS | Project 2 | 시스템콜 구현 (halt, exit, exec, create, remove, open, filesize) ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |