git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Code-base clean-up and refactoring (#47)
[lunaix-os.git]
/
lunaix-os
/
kernel
/
process
/
fork.c
diff --git
a/lunaix-os/kernel/process/fork.c
b/lunaix-os/kernel/process/fork.c
index c106650ca51f4fd6353640c2109efee9c273d312..6a6be4b3c15ae2321d9d67c49f8f714c69ff8793 100644
(file)
--- a/
lunaix-os/kernel/process/fork.c
+++ b/
lunaix-os/kernel/process/fork.c
@@
-8,9
+8,10
@@
#include <lunaix/syscall.h>
#include <lunaix/syslog.h>
#include <lunaix/signal.h>
#include <lunaix/syscall.h>
#include <lunaix/syslog.h>
#include <lunaix/signal.h>
+#include <lunaix/kpreempt.h>
-#include <
sys
/abi.h>
-#include <
sys/m
m/mm_defs.h>
+#include <
asm
/abi.h>
+#include <
as
m/mm_defs.h>
#include <klibc/string.h>
#include <klibc/string.h>
@@
-62,12
+63,12
@@
__dup_kernel_stack(struct thread* thread, ptr_t vm_mnt)
struct leaflet* leaflet;
ptr_t kstack_pn = pfn(current_thread->kstack);
struct leaflet* leaflet;
ptr_t kstack_pn = pfn(current_thread->kstack);
- kstack_pn -= pfn(KSTACK_SIZE)
- 1
;
+ kstack_pn -= pfn(KSTACK_SIZE);
// copy the kernel stack
pte_t* src_ptep = mkptep_pn(VMS_SELF, kstack_pn);
pte_t* dest_ptep = mkptep_pn(vm_mnt, kstack_pn);
// copy the kernel stack
pte_t* src_ptep = mkptep_pn(VMS_SELF, kstack_pn);
pte_t* dest_ptep = mkptep_pn(vm_mnt, kstack_pn);
- for (size_t i = 0; i < pfn(KSTACK_SIZE); i++) {
+ for (size_t i = 0; i <
=
pfn(KSTACK_SIZE); i++) {
pte_t p = *src_ptep;
if (pte_isguardian(p)) {
pte_t p = *src_ptep;
if (pte_isguardian(p)) {
@@
-106,7
+107,7
@@
dup_active_thread(ptr_t vm_mnt, struct proc_info* duped_pcb)
return NULL;
}
return NULL;
}
- th->
intr_ctx = current_thread->intr_ctx
;
+ th->
hstate = current_thread->hstate
;
th->kstack = current_thread->kstack;
signal_dup_context(&th->sigctx);
th->kstack = current_thread->kstack;
signal_dup_context(&th->sigctx);
@@
-149,9
+150,8
@@
done:
pid_t
dup_proc()
{
pid_t
dup_proc()
{
- // FIXME need investigate: issue with fork, as well as pthread
- // especially when involving frequent alloc and dealloc ops
- // (could be issue in allocator's segregated free list)
+ no_preemption();
+
struct proc_info* pcb = alloc_process();
if (!pcb) {
syscall_result(ENOMEM);
struct proc_info* pcb = alloc_process();
if (!pcb) {
syscall_result(ENOMEM);