Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project 1 백업 및 커맨드 라인 파싱 구현 #26

Open
wants to merge 37 commits into
base: dev_sirloinbh
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6d73691
Feat : Project 1 백업
sirloinbh Dec 13, 2023
5c9046e
Feat : command line parsing 1 문자열 자르기
sirloinbh Dec 13, 2023
c23a312
Feat : command line parsing 2 자른 문자열 load하기
sirloinbh Dec 13, 2023
ecf59b4
Feat : command line parsing 3 인자값들을 스택에 올리기
sirloinbh Dec 13, 2023
1fc4f67
Feat : command line parsing 4 argumetn_stack 함수 구현
sirloinbh Dec 13, 2023
4a4a3c2
Feat : command line parsing 5 중간결과 확인
sirloinbh Dec 13, 2023
28ffdfe
Merge branch 'dev_sirloinbh' into feat/bh
sirloinbh Dec 13, 2023
752f1d5
Feat : system call handler 및 system call 구현 1 halt 함수 구현
sirloinbh Dec 13, 2023
0e23463
Feat : system call handler 및 system call 구현 2 exit 함수 구현
sirloinbh Dec 13, 2023
81e0893
Feat : system call handler 및 system call 구현 3 create 함수 구현
sirloinbh Dec 13, 2023
cc4961f
Feat : system call handler 및 system call 구현 4 remove 함수 구현
sirloinbh Dec 13, 2023
e0f241f
Feat : system call handler 및 system call 구현 5 open 함수 구현
sirloinbh Dec 13, 2023
a3ff886
Feat : system call handler 및 system call 구현 6 filesize 함수 구현
sirloinbh Dec 13, 2023
f201133
Feat : system call handler 및 system call 구현 7 read 함수 구현
sirloinbh Dec 13, 2023
9dcb426
Feat : system call handler 및 system call 구현 8 write 함수 구현
sirloinbh Dec 13, 2023
65825a6
Feat : system call handler 및 system call 구현 9 seek 함수 구현
sirloinbh Dec 13, 2023
c019ffd
Feat : system call handler 및 system call 구현 10 tell 함수 구현
sirloinbh Dec 13, 2023
efe0041
Feat : system call handler 및 system call 구현 11 close 함수 구현
sirloinbh Dec 13, 2023
aae7333
Feat : system call handler 및 system call 구현 12 check_address()함수 구현
sirloinbh Dec 13, 2023
44eb6cc
Feat : system call handler 및 system call 구현13 exec() 함수 구현
sirloinbh Dec 13, 2023
be31280
Feat : system call handler 및 system call 구현14 wait 함수 구현
sirloinbh Dec 13, 2023
7fc7d8d
Feat : system call handler 및 system call 구현15 fork 함수 구현
sirloinbh Dec 13, 2023
6f24032
Feat : process 함수 구현 1 process_wait 함수 구현
sirloinbh Dec 13, 2023
98543b4
Feat : process 함수 구현 2 process_exit 함수 구현
sirloinbh Dec 13, 2023
ff10b1d
Feat : process 함수 구현 3 process_fork 함수 구현
sirloinbh Dec 13, 2023
a1512f7
Feat : process 함수 구현 4 __do_fork() 함수 구현
sirloinbh Dec 13, 2023
4c871b1
Feat : process 함수 구현 5 duplicate_pte함수 구현
sirloinbh Dec 13, 2023
89d7025
Feat : 함수에 쓰이는 변수, 구조체, semaphore , file descriptor 선언 및 초기화
sirloinbh Dec 13, 2023
7b8419c
Feat, Fix : process 함수 구현 6 process_exit 함수 재구현
sirloinbh Dec 13, 2023
d638ddc
Fix : 변수명 버그 해결 및 헤더파일 include
sirloinbh Dec 13, 2023
511cb3b
Feat : process 함수 구현 7 get_child_process 함수 구현
sirloinbh Dec 13, 2023
cbe2da0
Feat : page fault함수 마지막에 exit(-1) 추가
sirloinbh Dec 13, 2023
cb27f67
Fix : fork 함수에서 받는 인자의 변수명을 수정, thread 구조체에 인터럽트 프레임 추가
sirloinbh Dec 13, 2023
044f301
Fix : do_fork에서 인터럽트 프레임 변수명을 올바르게 고침. load 후에 file_close 함수를 삭제
sirloinbh Dec 13, 2023
9878b6b
Feat : Extra Test 1 dup2 시스템 콜 구현
sirloinbh Dec 13, 2023
2600ac6
Feat : extra test dup2를 해결하려고 시도하다가 실패
sirloinbh Dec 13, 2023
9fe0e2d
Merge branch 'feat/bh' of https://github.com/songarden/pintOS_3team i…
sirloinbh Dec 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion include/threads/fixed_point.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@

/* Multi-Level Feedback Queue Scheduler 구현 시 추가한 헤더파일 */
#define F (1 << 14) /* fixed point 1 */
#define INT_MAX ((1 << 31) - 1)
#define INT_MIN (-(1 << 31))

#include <stdint.h> /* For int64_t */

// x and y denote fixed_point numbers in 17.14 format
// n is an integer

Expand All @@ -21,12 +23,14 @@ int div_mixed(int x, int n); /* FP와 int 나눗셈(x/n) */
/* 함수 본체 */

/* integer를 fixed point로 전환 */

int int_to_fp(int n)
{
return n * F;
}

/* FP를 int로 전환(버림) */

int fp_to_int(int x)
{
return x / F;
Expand Down
6 changes: 3 additions & 3 deletions userprog/Make.vars
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ TEST_SUBDIRS = tests/userprog tests/filesys/base tests/userprog/no-vm tests/thre
GRADING_FILE = $(SRCDIR)/tests/userprog/Grading.no-extra

# Uncomment the lines below to submit/test extra for project 2.
# TDEFINE := -DEXTRA2
# TEST_SUBDIRS += tests/userprog/dup2
# GRADING_FILE = $(SRCDIR)/tests/userprog/Grading.extra
TDEFINE := -DEXTRA2
TEST_SUBDIRS += tests/userprog/dup2
GRADING_FILE = $(SRCDIR)/tests/userprog/Grading.extra
64 changes: 64 additions & 0 deletions userprog/build/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# -*- makefile -*-

SRCDIR = ../..

all: os.dsk

include ../../Make.config
include ../Make.vars
include ../../tests/Make.tests

# Compiler and assembler options.
os.dsk: CPPFLAGS += -I$(SRCDIR)/lib/kernel

# Core kernel.
include ../../threads/targets.mk
# User process code.
include ../../userprog/targets.mk
# Virtual memory code.
include ../../vm/targets.mk
# Filesystem code.
include ../../filesys/targets.mk
# Library code shared between kernel and user programs.
include ../../lib/targets.mk
# Kernel-specific library code.
include ../../lib/kernel/targets.mk
# Device driver code.
include ../../devices/targets.mk

SOURCES = $(foreach dir,$(KERNEL_SUBDIRS),$($(dir)_SRC))
OBJECTS = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(SOURCES)))
DEPENDS = $(patsubst %.o,%.d,$(OBJECTS))

threads/kernel.lds.s: CPPFLAGS += -P
threads/kernel.lds.s: threads/kernel.lds.S

kernel.o: threads/kernel.lds.s $(OBJECTS)
$(LD) $(LDFLAGS) -T $< -o $@ $(OBJECTS)

kernel.bin: kernel.o
$(OBJCOPY) -O binary -R .note -R .comment -S $< [email protected]
dd [email protected] of=$@ bs=4096 conv=sync
rm [email protected]

threads/loader.o: threads/loader.S kernel.bin
$(CC) -c $< -o $@ $(ASFLAGS) $(CPPFLAGS) $(DEFINES) -DKERNEL_LOAD_PAGES=`perl -e 'print +(-s "kernel.bin") / 4096;'`

loader.bin: threads/loader.o
$(LD) $(LDFLAGS) -N -e start -Ttext 0x7c00 --oformat binary -o $@ $<

os.dsk: loader.bin kernel.bin
cat $^ > $@

clean::
rm -f $(OBJECTS) $(DEPENDS)
rm -f threads/loader.o threads/kernel.lds.s threads/loader.d
rm -f kernel.o kernel.lds.s
rm -f kernel.bin loader.bin os.dsk
rm -f bochsout.txt bochsrc.txt
rm -f results grade

Makefile: $(SRCDIR)/Makefile.build
cp $< $@

-include $(DEPENDS)
Binary file added userprog/build/kernel.bin
Binary file not shown.
Binary file added userprog/build/loader.bin
Binary file not shown.
Binary file added userprog/build/os.dsk
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/child-syn-read
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/child-syn-wrt
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/lg-create
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/lg-full
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/lg-random
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/lg-seq-block
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/lg-seq-random
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/sm-create
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/sm-full
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/sm-random
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/sm-seq-block
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/sm-seq-random
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/syn-read
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/syn-remove
Binary file not shown.
Binary file added userprog/build/tests/filesys/base/syn-write
Binary file not shown.
Binary file added userprog/build/tests/userprog/args-dbl-space
Binary file not shown.
Binary file added userprog/build/tests/userprog/args-many
Binary file not shown.
Binary file added userprog/build/tests/userprog/args-multiple
Binary file not shown.
Binary file added userprog/build/tests/userprog/args-none
Binary file not shown.
Binary file added userprog/build/tests/userprog/args-single
Binary file not shown.
Binary file added userprog/build/tests/userprog/bad-jump
Binary file not shown.
Binary file added userprog/build/tests/userprog/bad-jump2
Binary file not shown.
Binary file added userprog/build/tests/userprog/bad-read
Binary file not shown.
Binary file added userprog/build/tests/userprog/bad-read2
Binary file not shown.
Binary file added userprog/build/tests/userprog/bad-write
Binary file not shown.
Binary file added userprog/build/tests/userprog/bad-write2
Binary file not shown.
Binary file added userprog/build/tests/userprog/child-args
Binary file not shown.
Binary file added userprog/build/tests/userprog/child-bad
Binary file not shown.
Binary file added userprog/build/tests/userprog/child-close
Binary file not shown.
Binary file added userprog/build/tests/userprog/child-read
Binary file not shown.
Binary file added userprog/build/tests/userprog/child-rox
Binary file not shown.
Binary file added userprog/build/tests/userprog/child-simple
Binary file not shown.
Binary file added userprog/build/tests/userprog/close-bad-fd
Binary file not shown.
Binary file added userprog/build/tests/userprog/close-normal
Binary file not shown.
Binary file added userprog/build/tests/userprog/close-twice
Binary file not shown.
Binary file added userprog/build/tests/userprog/create-bad-ptr
Binary file not shown.
Binary file added userprog/build/tests/userprog/create-bound
Binary file not shown.
Binary file added userprog/build/tests/userprog/create-empty
Binary file not shown.
Binary file added userprog/build/tests/userprog/create-exists
Binary file not shown.
Binary file added userprog/build/tests/userprog/create-long
Binary file not shown.
Binary file added userprog/build/tests/userprog/create-normal
Binary file not shown.
Binary file added userprog/build/tests/userprog/create-null
Binary file not shown.
Binary file added userprog/build/tests/userprog/dup2/dup2-complex
Binary file not shown.
Binary file added userprog/build/tests/userprog/dup2/dup2-simple
Binary file not shown.
Binary file added userprog/build/tests/userprog/exec-arg
Binary file not shown.
Binary file added userprog/build/tests/userprog/exec-bad-ptr
Binary file not shown.
Binary file added userprog/build/tests/userprog/exec-boundary
Binary file not shown.
Binary file added userprog/build/tests/userprog/exec-missing
Binary file not shown.
Binary file added userprog/build/tests/userprog/exec-once
Binary file not shown.
Binary file added userprog/build/tests/userprog/exec-read
Binary file not shown.
Binary file added userprog/build/tests/userprog/exit
Binary file not shown.
Binary file added userprog/build/tests/userprog/fork-boundary
Binary file not shown.
Binary file added userprog/build/tests/userprog/fork-close
Binary file not shown.
Binary file added userprog/build/tests/userprog/fork-multiple
Binary file not shown.
Binary file added userprog/build/tests/userprog/fork-once
Binary file not shown.
Binary file added userprog/build/tests/userprog/fork-read
Binary file not shown.
Binary file added userprog/build/tests/userprog/fork-recursive
Binary file not shown.
Binary file added userprog/build/tests/userprog/halt
Binary file not shown.
Binary file added userprog/build/tests/userprog/multi-child-fd
Binary file not shown.
Binary file added userprog/build/tests/userprog/multi-recurse
Binary file not shown.
Binary file added userprog/build/tests/userprog/no-vm/multi-oom
Binary file not shown.
Binary file added userprog/build/tests/userprog/open-bad-ptr
Binary file not shown.
Binary file added userprog/build/tests/userprog/open-boundary
Binary file not shown.
Binary file added userprog/build/tests/userprog/open-empty
Binary file not shown.
Binary file added userprog/build/tests/userprog/open-missing
Binary file not shown.
Binary file added userprog/build/tests/userprog/open-normal
Binary file not shown.
Binary file added userprog/build/tests/userprog/open-null
Binary file not shown.
Binary file added userprog/build/tests/userprog/open-twice
Binary file not shown.
Binary file added userprog/build/tests/userprog/read-bad-fd
Binary file not shown.
Binary file added userprog/build/tests/userprog/read-bad-ptr
Binary file not shown.
Binary file added userprog/build/tests/userprog/read-boundary
Binary file not shown.
Binary file added userprog/build/tests/userprog/read-normal
Binary file not shown.
Binary file added userprog/build/tests/userprog/read-stdout
Binary file not shown.
Binary file added userprog/build/tests/userprog/read-zero
Binary file not shown.
Binary file added userprog/build/tests/userprog/rox-child
Binary file not shown.
Binary file added userprog/build/tests/userprog/rox-multichild
Binary file not shown.
Binary file added userprog/build/tests/userprog/rox-simple
Binary file not shown.
Binary file added userprog/build/tests/userprog/wait-bad-pid
Binary file not shown.
Binary file added userprog/build/tests/userprog/wait-killed
Binary file not shown.
Binary file added userprog/build/tests/userprog/wait-simple
Binary file not shown.
Binary file added userprog/build/tests/userprog/wait-twice
Binary file not shown.
Binary file added userprog/build/tests/userprog/write-bad-fd
Binary file not shown.
Binary file added userprog/build/tests/userprog/write-bad-ptr
Binary file not shown.
Binary file added userprog/build/tests/userprog/write-boundary
Binary file not shown.
Binary file added userprog/build/tests/userprog/write-normal
Binary file not shown.
Binary file added userprog/build/tests/userprog/write-stdin
Binary file not shown.
Binary file added userprog/build/tests/userprog/write-zero
Binary file not shown.
23 changes: 23 additions & 0 deletions userprog/build/threads/kernel.lds.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
OUTPUT_FORMAT("elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)
SECTIONS
{
. = 0x8004000000 + 0x200000;
PROVIDE(start = .);
.text : AT(0x200000) {
*(.entry)
*(.text .text.* .stub .gnu.linkonce.t.*)
} = 0x90
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
. = ALIGN(0x1000);
PROVIDE(_end_kernel_text = .);
.data : { *(.data) *(.data.*)}
PROVIDE(_start_bss = .);
.bss : { *(.bss) }
PROVIDE(_end_bss = .);
PROVIDE(_end = .);
/DISCARD/ : {
*(.eh_frame .note.GNU-stack .stab)
}
}
2 changes: 2 additions & 0 deletions userprog/exception.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ page_fault (struct intr_frame *f) {
write = (f->error_code & PF_W) != 0;
user = (f->error_code & PF_U) != 0;

exit(-1);

#ifdef VM
/* For project 3 and later. */
if (vm_try_handle_fault (f, fault_addr, user, write, not_present))
Expand Down
Loading