From 8e81ff7ed279c0f57da088cf814111ca46d364ac Mon Sep 17 00:00:00 2001
From: Alex <alexander3.stratford@live.uwe.ac.uk>
Date: Mon, 2 Dec 2019 14:21:28 +0000
Subject: [PATCH] Moved move_stack_pointer() to above populate_stack()

---
 userprog/populate_stack.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/userprog/populate_stack.c b/userprog/populate_stack.c
index 67438b5..7be8c7d 100644
--- a/userprog/populate_stack.c
+++ b/userprog/populate_stack.c
@@ -8,6 +8,10 @@
 #include "threads/vaddr.h"
 #include "userprog/argument_parsing.h"
 
+ // Adds the move value to the stack pointer
+static void move_stack_pointer(void** stack_pointer, int move_value) {
+	*stack_pointer = *stack_pointer + move_value;
+}
 
 void populate_stack(void** stack_pointer, int argc, char** argv) {
 	*stack_pointer = PHYS_BASE;
@@ -47,9 +51,4 @@ void populate_stack(void** stack_pointer, int argc, char** argv) {
 	move_stack_pointer(*stack_pointer, -4); //Moves the stack pointer back 4
 
 	(*(int *)(*stack_pointer)) = 0;
-}
-
-// Adds the move value to the stack pointer
-static void move_stack_pointer(void** stack_pointer, int move_value) {
-	*stack_pointer = *stack_pointer + move_value;
 }
\ No newline at end of file
-- 
GitLab