mirror of
https://github.com/drasko/codezero.git
synced 2026-01-15 04:13:16 +01:00
Changes to make sure after a fork a child process can safely return.
This copies the parent kernel stack to child only for the part where the previous context is saved. Then the child registers are modified so that it would begin execution from returning of the system call.
This commit is contained in:
@@ -57,8 +57,11 @@ struct ktcb {
|
||||
/* User context */
|
||||
task_context_t context;
|
||||
|
||||
/* Reference to syscall saved context */
|
||||
syscall_args_t *syscall_regs;
|
||||
/*
|
||||
* Reference to the context on stack
|
||||
* saved at the beginning of a syscall trap.
|
||||
*/
|
||||
syscall_context_t *syscall_regs;
|
||||
|
||||
/* Runqueue related */
|
||||
struct list_head rq_list;
|
||||
|
||||
@@ -18,7 +18,12 @@
|
||||
|
||||
extern unsigned int __syscall_page_start;
|
||||
|
||||
typedef struct syscall_args {
|
||||
/*
|
||||
* This structure is saved on the kernel stack
|
||||
* just after entering a system call exception.
|
||||
*/
|
||||
typedef struct syscall_context {
|
||||
u32 spsr
|
||||
u32 r0;
|
||||
u32 r1;
|
||||
u32 r2;
|
||||
@@ -28,7 +33,9 @@ typedef struct syscall_args {
|
||||
u32 r6; /* MR3 */
|
||||
u32 r7; /* MR4 */
|
||||
u32 r8; /* MR5 */
|
||||
} syscall_args_t;
|
||||
u32 sp_usr;
|
||||
u32 lr_usr;
|
||||
} __attribute__((__packed__)) syscall_context_t;
|
||||
|
||||
typedef struct msg_regs {
|
||||
u32 mr0;
|
||||
|
||||
Reference in New Issue
Block a user