[TIL] [WEEK11-12] Pintos Project(3) Stack Growth

woo__jยท2024๋…„ 6์›” 13์ผ
1

Pintos Project

๋ชฉ๋ก ๋ณด๊ธฐ
12/14

ํ”„๋กœ์ ํŠธ 2์—์„œ ์Šคํƒ์€ USER_STACK์—์„œ ์‹œ์ž‘ํ•˜๋Š” ๋‹จ์ผ ํŽ˜์ด์ง€์˜€์œผ๋ฉฐ, ์ด ํฌ๊ธฐ๋ฅผ 4KB๋กœ ์ œํ•œํ•ด ์‹คํ–‰ํ–ˆ๋‹ค.
์ด์ œ ํ•ด๋‹น ํŒŒํŠธ์—์„œ๋Š” ์Šคํƒ์ด ํ˜„์žฌ ํฌ๊ธฐ๋ฅผ ์ดˆ๊ณผํ•  ๋•Œ ํ•„์š”์— ๋”ฐ๋ผ ์ถ”๊ฐ€ ํŽ˜์ด์ง€๋ฅผ ํ• ๋‹นํ•˜๋Š” Stack Growth๋ฅผ ๊ตฌํ˜„ํ•œ๋‹ค.

๐Ÿ“์„ธ ๋ฒˆ์งธ ๊ณผ์ œ, Stack Growth

Stack Growth?
: ์ ‘๊ทผํ•œ ๊ฐ€์ƒ์ฃผ์†Œ์— ๋งคํ•‘๋œ frame์ด ์—†์–ด์„œ page fault๊ฐ€ ๋ฐœ์ƒํ•œ ๊ฒฝ์šฐ, Stack์„ ๋Š˜๋ ค ์ถ”๊ฐ€ ํŽ˜์ด์ง€๋ฅผ ํ• ๋‹นํ•ด page fault๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ์‹์ด๋‹ค.์ด๋Š” ๊ฐ€์ƒ์ฃผ์†Œ๊ฐ€ stack์— ์ ‘๊ทผํ•˜๋Š” ๊ฒฝ์šฐ์—๋งŒ ์ ์šฉ๋œ๋‹ค.

์šฐ๋ฆฌ๊ฐ€ ์ƒ๊ฐํ•ด์•ผ ํ•  ๊ฒƒ์€ ํฌ๊ฒŒ 3๊ฐ€์ง€๋‹ค.

1. ์ ‘๊ทผํ•œ ๊ฐ€์ƒ์ฃผ์†Œ๊ฐ€ stack์ธ์ง€ ํŒ๋ณ„
2. stack growth๋กœ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ์ธ์ง€ ํŒ๋ณ„
3. stack growth ๊ธฐ๋Šฅ ๊ตฌํ˜„

๐Ÿ› ๏ธ ์ ‘๊ทผํ•œ ๊ฐ€์ƒ์ฃผ์†Œ๊ฐ€ stack์ธ์ง€ ํŒ๋ณ„ํ•˜๊ธฐ

pintOS์—์„œ๋Š” Stack์˜ ํฌ๊ธฐ๋ฅผ 1MB๋กœ ์ œํ•œํ•˜๊ณ  ์žˆ๋‹ค.
๊ทธ๋ ‡๋‹ค๋ฉด ์Šคํƒ์˜ ์˜์—ญ์€ 'USER_STACK'์—์„œ๋ถ€ํ„ฐ 'USER_STACK-1MB'์ผ ๊ฒƒ์ด๋‹ค.
์Šคํƒ์€ ๋†’์€ ์ฃผ์†Œ์—์„œ ๋‚ฎ์€ ์ฃผ์†Œ๋กœ ์ปค์ง€๊ธฐ ๋•Œ๋ฌธ์— -1MB๋ฅผ ํ•ด์•ผ ํ•œ๋‹ค.

์ด๋ฅผ ์ฝ”๋“œ๋กœ ๊ตฌํ˜„ํ•˜๋ฉด 'USER_STACK - (1 << 20)'์ด๋‹ค.
Bit masking์œผ๋กœ ํ‘œํ˜„ํ•œ ๊ฒƒ์œผ๋กœ, 1 << 20 = 2์˜ 20์Šน = 1MB

์ฆ‰, USER_STACK - 1MB = ์Šคํƒ์ด ๊ฐ€์งˆ ์ˆ˜ ์žˆ๋Š” ์ตœ๋Œ€ ํฌ๊ธฐ์˜ ์ตœํ•˜๋‹จ ์ฃผ์†Œ๊ฐ€ ๋œ๋‹ค.

if(USER_STACK - (1 << 20) <= addr && addr <= USER_STACK){
	= addr์ด ์Šคํƒ ์˜์—ญ ๋‚ด๋ฅผ ๊ฐ€๋ฆฌํ‚จ๋‹ค๋Š” ๊ฑธ ์˜๋ฏธ
}

๐Ÿ› ๏ธ Stack Growth๋กœ page fault๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ์ธ์ง€ ํŒ๋ณ„ํ•˜๊ธฐ

๊ทธ๋Ÿฐ๋ฐ ์ ‘๊ทผํ•œ ๊ฐ€์ƒ์ฃผ์†Œ๊ฐ€ stack์ธ ๊ฒฝ์šฐ๋”๋ผ๋„ ๋ชจ๋‘ stack growth๋กœ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ๊ฑด ์•„๋‹ˆ๋‹ค.
์œ ์ € ํ”„๋กœ๊ทธ๋žจ์€ ์Šคํƒ ํฌ์ธํ„ฐ ์•„๋ž˜์˜ ์Šคํƒ์— ์“ธ ๊ฒฝ์šฐ ๋ฒ„๊ทธ๊ฐ€ ๋ฐœ์ƒํ•˜๊ธฐ ๋•Œ๋ฌธ์—, 'USER_STACK ~ ์Šคํƒ ํฌ์ธํ„ฐ๋ณด๋‹ค ๋†’์€ ์ฃผ์†Œ ๊ฐ’'์ธ ๊ฒฝ์šฐ์—๋งŒ stack growth๋ฅผ ์ ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

์™œ ์Šคํƒ ํฌ์ธํ„ฐ ์•„๋ž˜์—์„  stack growth๋ฅผ ์ ์šฉํ•  ์ˆ˜ ์—†์„๊นŒ?? ๐Ÿค”
: ์Šคํƒ ํฌ์ธํ„ฐ๋ณด๋‹ค ๋‚ฎ์€ ์ฃผ์†Œ๋ฅผ ๊ฐ€๋ฆฌํ‚ฌ ๋•Œ ํ•ด๋‹น ์œ„์น˜์— stack growth๋ฅผ ์ ์šฉ์‹œํ‚ค๋ฉด ์ƒˆ ํŽ˜์ด์ง€๋ฅผ ํ• ๋‹นํ•˜๊ณ  ๋ฐ์ดํ„ฐ๋ฅผ ์จ๋†“๋Š”๋‹ค๋ฉด, ๋ฐ์ดํ„ฐ๊ฐ€ ์˜ค์—ผ๋  ์ˆ˜ ์žˆ๋‹ค.
-> ์ด ๋ง์ด ๋ฌด์Šจ ์˜๋ฏธ๋ƒ?
์šด์˜์ฒด์ œ๊ฐ€ ์‹คํ–‰๋˜๋‹ค๊ฐ€ ํ”„๋กœ์„ธ์Šค๋ฅผ ์ค‘๋‹จ์‹œํ‚ฌ ๋•Œ ์‹คํ–‰๋˜๋˜ ์ •๋ณด๋ฅผ stack์— ์ €์žฅํ•˜๊ฒŒ ๋˜๋Š”๋ฐ, ์Šคํƒ ํฌ์ธํ„ฐ ์•„๋ž˜์— ๋ฐ์ดํ„ฐ๋ฅผ ์จ๋†“์•˜๋‹ค๋ฉด? ๋ฐ์ดํ„ฐ๊ฐ€ ๋ฎ์–ด์”Œ์›Œ์ง€๋ฉด์„œ ๋ณ€๊ฒฝ๋  ์ˆ˜ ์žˆ๋‹ค.
๋˜ํ•œ ์ดํ›„์— rsp๊ฐ€ ๋‚ด๋ ค์˜ค๋ฉด์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฝ์ž…ํ•  ๋•Œ๋„ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ๋ฐ์ดํ„ฐ๊ฐ€ ๋ฎ์–ด์”Œ์›Œ์งˆ ์ˆ˜ ์žˆ๋‹ค.

๊ทธ๋Ÿฐ๋ฐ ์Šคํƒ ํฌ์ธํ„ฐ๋ณด๋‹ค ๋†’์€์ง€ ๋‚ฎ์€์ง€๋ฅผ ์•Œ๊ธฐ ์œ„ํ•ด์„œ๋Š” user stack์˜ ์Šคํƒ ํฌ์ธํ„ฐ(= rsp)๋ฅผ ๋จผ์ € ์•Œ์•„๋‚ด์•ผ ํ•œ๋‹ค.

user program(User Mode)์—์„œ ๋ฐœ์ƒํ•œ page fault๋Š” ์ธ์ž๋กœ ์ „๋‹ฌ๋œ intr_frame์„ ํ†ตํ•ด rsp๋กœ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์ง€๋งŒ,

syscall(Kernel Mode)์—์„œ ๋ฐœ์ƒํ•œ page fault๋Š” ์ธ์ž๋กœ ์ „๋‹ฌ๋œ intr_frame->rsp๊ฐ€ user stack์˜ ์Šคํƒ ํฌ์ธํ„ฐ๊ฐ€ ์•„๋‹Œ kernel stack์˜ ์Šคํƒ ํฌ์ธํ„ฐ๋ฅผ ์–ป๊ฒŒ ๋œ๋‹ค.

๋”ฐ๋ผ์„œ kernel mode์—์„œ๋„ user stack์˜ rsp๋ฅผ ์–ป๊ธฐ ์œ„ํ•ด์„  user mode->kernel mode ์ดˆ๊ธฐ ์ „ํ™˜ ์‹œ(= syscall_handler()) struct thread์— ์ €์žฅํ•ด ์ „๋‹ฌํ•˜๋Š” ๋“ฑ์˜ ๋ฐฉ๋ฒ•์„ ์ค€๋น„ํ•ด์•ผ ํ•œ๋‹ค.

1. thread ๊ตฌ์กฐ์ฒด์— rsp ๋ฉค๋ฒ„๋ณ€์ˆ˜ ์ถ”๊ฐ€

struct thread 
{
	...
    #ifdef VM
	struct supplemental_page_table spt;
	void *rsp; // ์Šคํƒ ํฌ์ธํ„ฐ ์ €์žฅ์„ ์œ„ํ•œ ๋ฉค๋ฒ„๋ณ€์ˆ˜
	...
}

2. syscall_handler()์—์„œ rsp ์ €์žฅ

void syscall_handler(struct intr_frame *f UNUSED)
{
	...
    /* ์ปค๋„ ๋ชจ๋“œ๋กœ ์ „ํ™˜๋  ๋•Œ, ์ฆ‰ ์‹œ์Šคํ…œ ์ฝœ์ด ํ˜ธ์ถœ๋  ๋•Œ ์Šคํƒ ํฌ์ธํ„ฐ ์ €์žฅ */
	#ifdef VM
	thread_current()->rsp = f->rsp;
	...
}

์ด์ œ ์ด rsp๋ฅผ ํ™œ์šฉํ•ด ํŒ๋ณ„ํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ์ด๋‹ค.

๊ทธ๋ ‡๋‹ค๋ฉด ์กฐ๊ฑด๋ฌธ์„ ์•„๋ž˜์ฒ˜๋Ÿผ ์ ์šฉํ•˜๋ฉด ๋ ๊นŒ?

void *rsp = f->rsp;
if (!user)
{
	rsp = thread_current()->rsp;
}
        
/* stack growth๋กœ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ */
if (USER_STACK - (1 << 20) <= rsp && rsp <= addr && addr <= USER_STACK)
{
	vm_stack_growth(addr);
}

์•„๋‹ˆ, ํ•œ ๊ฐ€์ง€ ๊ณ ๋ คํ•  ๊ฒฝ์šฐ๊ฐ€ ๋” ์žˆ๋‹ค.
rsp๋ณด๋‹ค ๋‚ฎ์€ ์ฃผ์†Œ์— ์ ‘๊ทผํ•˜๋”๋ผ๋„ stack growth๋กœ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค.
x86-64์˜ PUSH ๋ช…๋ น์ด๋‹ค.

PUSH ๋ช…๋ น์€ ์Šคํƒ ํฌ์ธํ„ฐ๋ฅผ ์กฐ์ •ํ•˜๊ธฐ ์ „์— ์ ‘๊ทผ ๊ถŒํ•œ์„ ํ™•์ธํ•˜๊ธฐ ๋•Œ๋ฌธ์—, ์Šคํƒ ํฌ์ธํ„ฐ๋กœ๋ถ€ํ„ฐ 8๋ฐ”์ดํŠธ ์•„๋ž˜์—์„œ page fault๋ฅผ ๋ฐœ์ƒ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค.

rsp - 8byte์ธ ์ด์œ ? ๐Ÿค”
์Šคํƒ์— ๊ฐ’์„ PUSHํ•  ๋•Œ, 64bit ์‹œ์Šคํ…œ์—์„œ๋Š” 8byte ๋‹จ์œ„๋กœ ๋ฐ์ดํ„ฐ๋ฅผ pushํ•˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. (register = rax)
๋ฌผ๋ก  32bit ํ™˜๊ฒฝ์ด๋ผ๋ฉด - 4byte์ด๋‹ค. (register = eax)

๊ทธ๋Ÿฌ๋‹ˆ ๊ฐ€์ƒ์ฃผ์†Œ๊ฐ€ rsp-8 ์„ ๊ฐ€๋ฆฌํ‚ค๋Š” ๊ฒฝ์šฐ๋„ stack growth๋กœ page fault๋ฅผ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ค.
์ตœ์ข… ์กฐ๊ฑด๋ฌธ์€ ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

bool vm_try_handle_fault(struct intr_frame *f UNUSED, void *addr UNUSED, bool user UNUSED, bool write UNUSED, bool not_present UNUSED)
{
	...
    /* ์ ‘๊ทผํ•œ ๋ฉ”๋ชจ๋ฆฌ์˜ ๋ฌผ๋ฆฌ ํ”„๋ ˆ์ž„์ด ์กด์žฌํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ, not_present = true */
	if (not_present)
	{
    	void *rsp = f->rsp;
		if (!user)
        {
			rsp = thread_current()->rsp;
        }
        
		/* stack growth๋กœ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ */
		if (USER_STACK - (1 << 20) <= rsp && rsp <= addr && addr <= USER_STACK)
		{
			vm_stack_growth(addr);
		}else if(USER_STACK - (1 << 20) <= rsp - 8 && rsp - 8 == addr && addr <= USER_STACK){
        	vm_stack_growth(addr);
        }
        ...
    }
    return false;
}

ํ•ด๋‹น ์กฐ๊ฑด๋“ค์„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ •๋ฆฌํ–ˆ๋‹ค.


๐Ÿ› ๏ธ Stack Growth ๊ธฐ๋Šฅ ๊ตฌํ˜„

์ง€๊ธˆ๊นŒ์ง€ stack growth๋กœ ํŽ˜์ด์ง€ ํดํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ๋ฅผ ๋”ฐ์ ธ ํ˜ธ์ถœํ•˜๋Š” ๊ฒƒ๊นŒ์ง€ ๊ตฌํ˜„ํ–ˆ๋‹ค.
์ด์ œ ํ•ด๋‹น ํ•จ์ˆ˜๋งŒ ๊ตฌํ˜„ํ•˜๋ฉด ์ด๋ฒˆ ํŒŒํŠธ์˜ ๊ณผ์ œ๋ฅผ ์™„๋ฃŒํ•œ๋‹ค.

vm_stack_growth() ๊ตฌํ˜„์€ ์‚ฌ์‹ค ๊ฐ„๋‹จํ•˜๋‹ค.
์˜ฌ๋ฐ”๋ฅธ ์œ„์น˜์— ์ƒˆ ํŽ˜์ด์ง€๋ฅผ ํ• ๋‹นํ•˜๊ธฐ๋งŒ ํ•˜๋ฉด ๋œ๋‹ค. ๊ทธ๋ ‡๋‹ค๋ฉด ์ ‘๊ทผํ–ˆ๋˜ ์ฃผ์†Œ๊ฐ€ faulted ์ฃผ์†Œ์—์„œ ์œ ํšจํ•œ ์ฃผ์†Œ๊ฐ€ ๋˜์–ด page fault๋ฅผ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ค. ์ด๋ฅผ ์œ„ํ•ด ์ƒ๊ฐํ•ด์•ผ ํ•  ์ ์ด ๋‘ ๊ฐ€์ง€ ์žˆ๋‹ค.

1) ์–ด๋–ค ํƒ€์ž…์˜ ํŽ˜์ด์ง€๋ฅผ ํ• ๋‹นํ•ด์•ผ ํ• ๊นŒ?
2) ์–ด๋Š ์œ„์น˜์—์„œ ํŽ˜์ด์ง€๋ฅผ ํ• ๋‹นํ•ด์•ผ ํ• ๊นŒ?

์ผ๋‹จ ์ฒซ ๋ฒˆ์งธ๋Š”, ์ด์ „ ํŒŒํŠธ์ธ anon ํŒŒํŠธ์— ๋‹ต์ด ์žˆ๋‹ค.
anonymous page๋Š” ์Šคํƒ์ด๋‚˜ ํž™ ์˜์—ญ์—์„œ ์‚ฌ์šฉ๋œ๋‹ค๊ณ  ํ–ˆ๋‹ค.
์•„์ง ๋ฐ์ดํ„ฐ๊ฐ€ ๋งคํ•‘๋˜์ง€ ์•Š์€ ์ดˆ๊ธฐํ™”๋œ ํŽ˜์ด์ง€์—ฌ์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.

๋‘ ๋ฒˆ์งธ๋Š” ํŽ˜์ด์ง€ ๊ฒฝ๊ณ„ ์ฃผ์†Œ ์œ„์น˜์—์„œ ํ• ๋‹นํ•ด์•ผ ํ•œ๋‹ค.
๋ฉ”๋ชจ๋ฆฌ๋Š” ํŽ˜์ด์ง€ ๋‹จ์œ„๋กœ ๊ด€๋ฆฌ๋˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.

๊ทธ๋ ‡๋‹ค๋ฉด ์ด๋ฅผ ํ† ๋Œ€๋กœ vm_stack_growth()๋ฅผ ๊ตฌํ˜„ํ•ด๋ณด์ž.

static void
vm_stack_growth(void *addr UNUSED)
{
	/* addr์„ PGSIZE ๋งŒํผ ๋‚ด๋ ค anon page๋ฅผ ํ• ๋‹น */
	vm_alloc_page(VM_ANON | VM_MARKER_0, pg_round_down(addr), 1);
}

[์ตœ์ข… ์ •๋ฆฌํ•˜์ž๋ฉด]
1. page_fault ๋ฐœ์ƒ
2. vm_try_handle_fault() ํ˜ธ์ถœ
3. stack growth๋กœ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ํŒ๋ณ„
4. ์žˆ๋‹ค๋ฉด stack growth๋กœ ์ƒˆ ํŽ˜์ด์ง€ ํ• ๋‹น
5. spt์—์„œ ํ•ด๋‹น ๊ฐ€์ƒ ์ฃผ์†Œ์— ํ•ด๋‹นํ•˜๋Š” ํŽ˜์ด์ง€๋ฅผ ๋ฐ˜ํ™˜
6. ํ•ด๋‹น ํŽ˜์ด์ง€๋กœ vm_do_claim_page()๋ฅผ ํ˜ธ์ถœ
7. ๋ฌผ๋ฆฌ ํ”„๋ ˆ์ž„์„ ํ• ๋‹น๋ฐ›๊ณ  ๋งคํ•‘ํ•จ์œผ๋กœ์จ page fault ์ฒ˜๋ฆฌ


+) ์ถ”๊ฐ€๋กœ ์ •๋ฆฌํ•  ๊ฒƒ
: pg_round_down()์ด๋ž€ ๊ฒŒ ๊ทธ๋ƒฅ ํŽ˜์ด์ง€ ๊ฒฝ๊ณ„๋กœ ๋‚ด๋ฆผํ•˜๋Š” ๋งคํฌ๋กœ๋ผ๊ณ ๋งŒ ์ดํ•ดํ–ˆ์—ˆ๋Š”๋ฐ,
๋‹ค๋ฅธ ๋™๋ฃŒ์˜ ๋ฐœํ‘œ๋ฅผ ๋“ฃ๊ณ  ๋” ์ž์„ธํžˆ ์•Œ๊ฒŒ๋œ ์ ์ด ์žˆ๋‹ค.

pg_round_down()? ๐Ÿค”
๊ฐ€์ƒ์ฃผ์†Œ๋Š” PN(ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ)+offset์œผ๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ๋‹ค.
ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ๋Š” ํŽ˜์ด์ง€ ํฌ๊ธฐ์˜ ๋ฐฐ์ˆ˜์™€ ๊ฐ™๊ณ , ๊ฒฐ๊ตญ ํŽ˜์ด์ง€ ๊ฒฝ๊ณ„๋Š” ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ๋‚˜ ๋งˆ์ฐฌ๊ฐ€์ง€๋‹ค.
offset์€ ํ•ด๋‹น ํŽ˜์ด์ง€ ๋‚ด์˜ ์ •ํ™•ํ•œ ์œ„์น˜๋ฅผ ์ง€์ •ํ•˜๊ธฐ ์œ„ํ•œ ๋ถ€๋ถ„์ด๋‹ค.
๊ทธ๋Ÿฌ๋‹ˆ pg_round_down์€ offset์„ ๋–ผ์–ด๋‚ด ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ๋ฅผ ์–ป์–ด๋‚ด๋Š” ์ž‘์—…์„ ํ•˜๋Š” ๊ฒƒ์ด๋‹ค.
pg_round_down ๋งคํฌ๋กœ๋ฅผ ๋ณด๋ฉด ๋” ์ž์„ธํžˆ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

/* Page offset bits (0:12). */
#define PGMASK  BITMASK(PGSHIFT, PGBITS)
/* Round down to nearest page boundary. */
#define pg_round_down(va) (void *) ((uint64_t) (va) & ~PGMASK)

์ด๋ ‡๊ฒŒ stack_growth ํŒŒํŠธ๊นŒ์ง€ ์™„๋ฃŒํ–ˆ๋‹ค.
stack ์„ฑ์žฅ๊ณผ ์—ฐ๊ด€๋œ tc๋“ค์ด ํ†ต๊ณผํ•˜๋Š” ๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค.

pass tests/userprog/args-none
pass tests/userprog/args-single
pass tests/userprog/args-multiple
pass tests/userprog/args-many
pass tests/userprog/args-dbl-space
pass tests/userprog/halt
pass tests/userprog/exit
pass tests/userprog/create-normal
pass tests/userprog/create-empty
pass tests/userprog/create-null
pass tests/userprog/create-bad-ptr
pass tests/userprog/create-long
pass tests/userprog/create-exists
pass tests/userprog/create-bound
pass tests/userprog/open-normal
pass tests/userprog/open-missing
pass tests/userprog/open-boundary
pass tests/userprog/open-empty
pass tests/userprog/open-null
pass tests/userprog/open-bad-ptr
pass tests/userprog/open-twice
pass tests/userprog/close-normal
pass tests/userprog/close-twice
pass tests/userprog/close-bad-fd
pass tests/userprog/read-normal
pass tests/userprog/read-bad-ptr
pass tests/userprog/read-boundary
pass tests/userprog/read-zero
pass tests/userprog/read-stdout
pass tests/userprog/read-bad-fd
pass tests/userprog/write-normal
pass tests/userprog/write-bad-ptr
pass tests/userprog/write-boundary
pass tests/userprog/write-zero
pass tests/userprog/write-stdin
pass tests/userprog/write-bad-fd
pass tests/userprog/fork-once
pass tests/userprog/fork-multiple
pass tests/userprog/fork-recursive
pass tests/userprog/fork-read
pass tests/userprog/fork-close
pass tests/userprog/fork-boundary
pass tests/userprog/exec-once
pass tests/userprog/exec-arg
pass tests/userprog/exec-boundary
pass tests/userprog/exec-missing
pass tests/userprog/exec-bad-ptr
pass tests/userprog/exec-read
pass tests/userprog/wait-simple
pass tests/userprog/wait-twice
pass tests/userprog/wait-killed
pass tests/userprog/wait-bad-pid
pass tests/userprog/multi-recurse
pass tests/userprog/multi-child-fd
pass tests/userprog/rox-simple
pass tests/userprog/rox-child
pass tests/userprog/rox-multichild
pass tests/userprog/bad-read
pass tests/userprog/bad-write
pass tests/userprog/bad-read2
pass tests/userprog/bad-write2
pass tests/userprog/bad-jump
pass tests/userprog/bad-jump2
pass tests/vm/pt-grow-stack
pass tests/vm/pt-grow-bad
pass tests/vm/pt-big-stk-obj
pass tests/vm/pt-bad-addr
pass tests/vm/pt-bad-read
pass tests/vm/pt-write-code
FAIL tests/vm/pt-write-code2
pass tests/vm/pt-grow-stk-sc
pass tests/vm/page-linear
pass tests/vm/page-parallel
pass tests/vm/page-merge-seq
FAIL tests/vm/page-merge-par
FAIL tests/vm/page-merge-stk
FAIL tests/vm/page-merge-mm
pass tests/vm/page-shuffle
FAIL tests/vm/mmap-read
FAIL tests/vm/mmap-close
FAIL tests/vm/mmap-unmap
FAIL tests/vm/mmap-overlap
FAIL tests/vm/mmap-twice
FAIL tests/vm/mmap-write
pass tests/vm/mmap-ro
FAIL tests/vm/mmap-exit
FAIL tests/vm/mmap-shuffle
FAIL tests/vm/mmap-bad-fd
FAIL tests/vm/mmap-clean
FAIL tests/vm/mmap-inherit
FAIL tests/vm/mmap-misalign
FAIL tests/vm/mmap-null
FAIL tests/vm/mmap-over-code
FAIL tests/vm/mmap-over-data
FAIL tests/vm/mmap-over-stk
FAIL tests/vm/mmap-remove
pass tests/vm/mmap-zero
FAIL tests/vm/mmap-bad-fd2
FAIL tests/vm/mmap-bad-fd3
FAIL tests/vm/mmap-zero-len
FAIL tests/vm/mmap-off
FAIL tests/vm/mmap-bad-off
FAIL tests/vm/mmap-kernel
FAIL tests/vm/lazy-file
pass tests/vm/lazy-anon
FAIL tests/vm/swap-file
FAIL tests/vm/swap-anon
FAIL tests/vm/swap-iter
FAIL tests/vm/swap-fork
pass tests/filesys/base/lg-create
pass tests/filesys/base/lg-full
pass tests/filesys/base/lg-random
pass tests/filesys/base/lg-seq-block
pass tests/filesys/base/lg-seq-random
pass tests/filesys/base/sm-create
pass tests/filesys/base/sm-full
pass tests/filesys/base/sm-random
pass tests/filesys/base/sm-seq-block
pass tests/filesys/base/sm-seq-random
FAIL tests/filesys/base/syn-read
pass tests/filesys/base/syn-remove
FAIL tests/filesys/base/syn-write
pass tests/threads/alarm-single
pass tests/threads/alarm-multiple
pass tests/threads/alarm-simultaneous
pass tests/threads/alarm-priority
pass tests/threads/alarm-zero
pass tests/threads/alarm-negative
pass tests/threads/priority-change
pass tests/threads/priority-donate-one
pass tests/threads/priority-donate-multiple
pass tests/threads/priority-donate-multiple2
pass tests/threads/priority-donate-nest
pass tests/threads/priority-donate-sema
pass tests/threads/priority-donate-lower
pass tests/threads/priority-fifo
pass tests/threads/priority-preempt
pass tests/threads/priority-sema
pass tests/threads/priority-condvar
pass tests/threads/priority-donate-chain
FAIL tests/vm/cow/cow-simple
35 of 141 tests failed.

โš™๏ธ Modify List

- strcut thread
- syscall_handler()
- vm_try_handle_fault()
- vm_stack_growth()

0๊ฐœ์˜ ๋Œ“๊ธ€

๊ด€๋ จ ์ฑ„์šฉ ์ •๋ณด