Changeset 128359eb in mainline for kernel/generic
- Timestamp:
- 2020-06-12T16:46:32Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ffccdff0
- Parents:
- 94e75cf
- Location:
- kernel/generic
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/arch.h
r94e75cf r128359eb 36 36 #define KERN_ARCH_H_ 37 37 38 #include <arch/asm.h> /* get_stack_base() */39 38 #include <config.h> 40 39 41 /* 40 /** Return the current_t structure 41 * 42 42 * The current_t structure holds pointers to various parts of the current 43 43 * execution state, like running task, thread, address space, etc. 44 * 45 * The current_t structure is located at the base address of the current 46 * stack. The stack is assumed to be STACK_SIZE bytes long. The stack base 47 * address must be aligned to STACK_SIZE. 48 * 44 49 */ 45 #define CURRENT ((current_t * )(get_stack_base())) 50 #define CURRENT \ 51 ((current_t *) (((uintptr_t) __builtin_frame_address(0)) & \ 52 (~((uintptr_t) STACK_SIZE - 1)))) 46 53 47 #define MAGIC 54 #define MAGIC UINT32_C(0xfacefeed) 48 55 49 56 #define container_check(ctn1, ctn2) ((ctn1) == (ctn2)) … … 59 66 struct as; 60 67 61 /** 68 /** Current structure 69 * 62 70 * For each possible kernel stack, structure 63 71 * of the following type will be placed at 64 72 * the base address of the stack. 73 * 65 74 */ 66 75 typedef struct { 67 size_t preemption; /**< Preemption disabled counter and flag. */68 struct thread *thread; /**< Current thread. */69 struct task *task; /**< Current task. */70 struct cpu *cpu; /**< Executing cpu. */71 struct as *as; /**< Current address space. */72 uint32_t magic; /**< Magic value*/76 size_t preemption; /**< Preemption disabled counter and flag. */ 77 struct thread *thread; /**< Current thread. */ 78 struct task *task; /**< Current task. */ 79 struct cpu *cpu; /**< Executing CPU. */ 80 struct as *as; /**< Current address space. */ 81 uint32_t magic; /**< Magic value. */ 73 82 } current_t; 74 83 … … 89 98 } while (0) 90 99 91 #define ARCH_OP(op) 100 #define ARCH_OP(op) ARCH_STRUCT_OP(arch_ops, op) 92 101 93 102 extern void current_initialize(current_t *); -
kernel/generic/src/cpu/cpu.c
r94e75cf r128359eb 71 71 memsetb(cpus, sizeof(cpu_t) * config.cpu_count, 0); 72 72 73 // NOTE: All kernel stacks must be aligned to STACK_SIZE, 74 // see get_stack_base(). 75 size_t i; 76 for (i = 0; i < config.cpu_count; i++) { 73 /* 74 * NOTE: All kernel stacks must be aligned to STACK_SIZE, 75 * see CURRENT. 76 */ 77 for (size_t i = 0; i < config.cpu_count; i++) { 77 78 uintptr_t stack_phys = frame_alloc(STACK_FRAMES, 78 79 FRAME_LOWMEM | FRAME_ATOMIC, STACK_SIZE - 1); -
kernel/generic/src/main/main.c
r94e75cf r128359eb 170 170 ALIGN_UP((uintptr_t) kdata_end - config.base, PAGE_SIZE); 171 171 172 // NOTE: All kernel stacks must be aligned to STACK_SIZE, 173 // see get_stack_base(). 172 /* 173 * NOTE: All kernel stacks must be aligned to STACK_SIZE, 174 * see CURRENT. 175 */ 174 176 175 177 /* Place the stack after the kernel, init and ballocs. */ -
kernel/generic/src/proc/thread.c
r94e75cf r128359eb 191 191 kmflags &= ~FRAME_HIGHMEM; 192 192 193 // NOTE: All kernel stacks must be aligned to STACK_SIZE, 194 // see get_stack_base(). 193 /* 194 * NOTE: All kernel stacks must be aligned to STACK_SIZE, 195 * see CURRENT. 196 */ 195 197 196 198 uintptr_t stack_phys =
Note:
See TracChangeset
for help on using the changeset viewer.