summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorrsc <rsc>2006-07-16 01:47:40 +0000
committerrsc <rsc>2006-07-16 01:47:40 +0000
commit856e1fc1ad22a24bd71c706bc06ba868e044ddc8 (patch)
tree203bf24aa99e2f50d4bca375231d3fb46332ba29 /main.c
parent65bd8e139a8368e987455a10ec59dd7b079b3af1 (diff)
downloadxv6-labs-856e1fc1ad22a24bd71c706bc06ba868e044ddc8.tar.gz
xv6-labs-856e1fc1ad22a24bd71c706bc06ba868e044ddc8.tar.bz2
xv6-labs-856e1fc1ad22a24bd71c706bc06ba868e044ddc8.zip
Attempt to clean up newproc somewhat.
Also remove all calls to memcpy in favor of memmove, which has defined semantics when the ranges overlap. The fact that memcpy was working in console.c to scroll the screen is not guaranteed by all implementations.
Diffstat (limited to 'main.c')
-rw-r--r--main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/main.c b/main.c
index 70e93cf..5f2d698 100644
--- a/main.c
+++ b/main.c
@@ -81,7 +81,7 @@ main()
// become interruptable
sti();
- p = newproc();
+ p = copyproc(&proc[0]);
load_icode(p, _binary_usertests_start, (unsigned) _binary_usertests_size);
//load_icode(p, _binary_userfs_start, (unsigned) _binary_userfs_size);
@@ -122,7 +122,7 @@ load_icode(struct proc *p, uint8_t *binary, unsigned size)
panic("load_icode: icode wants to be above UTOP");
// Load/clear the segment
- memcpy(p->mem + ph->p_va, binary + ph->p_offset, ph->p_filesz);
+ memmove(p->mem + ph->p_va, binary + ph->p_offset, ph->p_filesz);
memset(p->mem + ph->p_va + ph->p_filesz, 0, ph->p_memsz - ph->p_filesz);
}
}