proc: copy memmap from parent
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
14c2f27d40
commit
30c14a0fef
6 changed files with 85 additions and 11 deletions
|
|
@ -16,11 +16,11 @@ struct cpu_local {
|
|||
struct pt_regs {
|
||||
u64 rax;
|
||||
u64 rbx;
|
||||
u64 rcx;
|
||||
u64 rcx;
|
||||
u64 rdx;
|
||||
u64 rdi;
|
||||
u64 rsi;
|
||||
u64 rbp;
|
||||
u64 rbp;
|
||||
u64 r8;
|
||||
u64 r9;
|
||||
u64 r10;
|
||||
|
|
@ -29,8 +29,11 @@ struct pt_regs {
|
|||
u64 r13;
|
||||
u64 r14;
|
||||
u64 r15;
|
||||
u64 rsp;
|
||||
u64 rip;
|
||||
u64 rsp;
|
||||
u64 rip;
|
||||
} PACKED;
|
||||
|
||||
struct cpu_local *tls_get();
|
||||
struct proc *get_cur_proc();
|
||||
|
||||
#endif /* _ARCH_PROC_H_ */
|
||||
|
|
|
|||
19
amd64/kernel/proc.c
Normal file
19
amd64/kernel/proc.c
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#include <arch/proc.h>
|
||||
#include <kernel/proc.h>
|
||||
#include "arch/msr.h"
|
||||
|
||||
struct cpu_local *tls_get()
|
||||
{
|
||||
return (void *)rdmsr(IA32_GS_BASE);
|
||||
}
|
||||
|
||||
struct proc *get_cur_proc()
|
||||
{
|
||||
struct cpu_local *l = tls_get();
|
||||
if (!l)
|
||||
return NULL;
|
||||
if (!l->cur_thread)
|
||||
return NULL;
|
||||
return l->cur_thread->proc;
|
||||
}
|
||||
Loading…
Reference in a new issue