Changeset 32e8cd1 in mainline for kernel/arch/sparc32/src/userspace.c
- Timestamp:
- 2013-12-28T17:16:44Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c1023bcb
- Parents:
- f6f22cdb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc32/src/userspace.c
rf6f22cdb r32e8cd1 27 27 */ 28 28 29 /** @addtogroup abs32le29 /** @addtogroup sparc32 30 30 * @{ 31 31 */ … … 42 42 void userspace(uspace_arg_t *kernel_uarg) 43 43 { 44 // printf("userspace(): entry=%p, stack=%p, stacksize=%d\n", kernel_uarg->uspace_entry, kernel_uarg->uspace_stack, kernel_uarg->uspace_stack_size);45 /* On real hardware this switches the CPU to user46 space mode and jumps to kernel_uarg->uspace_entry. */47 48 uint32_t l0, l1, l2;49 44 uint32_t psr = psr_read(); 50 uint8_t wim;51 52 45 psr &= ~(1 << 7); 53 46 psr &= ~(1 << 6); 54 47 55 48 /* Read invalid window variables */ 49 uint32_t l0; 50 uint32_t l1; 51 uint32_t l2; 56 52 read_from_invalid(&l0, &l1, &l2); 57 53 58 54 /* Make current window invalid */ 59 wim = (psr & 0x7) + 1;55 uint8_t wim = (psr & 0x7) + 1; 60 56 wim = (1 << wim) | (1 >> (8 - wim)); 61 57 62 58 asm volatile ( 63 59 "flush\n" … … 71 67 "ld %[arg], %%o1\n" 72 68 "jmp %[entry]\n" 73 "mov %[psr], %%psr\n" :: [entry] "r" (kernel_uarg->uspace_entry), 74 [arg] "m" (kernel_uarg->uspace_uarg), 75 [psr] "r" (psr), 76 [wim] "r" ((uint32_t)wim), 77 [v0] "m" (l0), 78 [v1] "m" (l1), 79 [v2] "m" (l2), 80 [stack] "r" (kernel_uarg->uspace_stack + kernel_uarg->uspace_stack_size - 64) : "%g3", "%g4"); 81 82 while (true); 69 "mov %[psr], %%psr\n" 70 :: [entry] "r" (kernel_uarg->uspace_entry), 71 [arg] "m" (kernel_uarg->uspace_uarg), 72 [psr] "r" (psr), 73 [wim] "r" ((uint32_t)wim), 74 [v0] "m" (l0), 75 [v1] "m" (l1), 76 [v2] "m" (l2), 77 [stack] "r" (kernel_uarg->uspace_stack + 78 kernel_uarg->uspace_stack_size - 64) 79 : "%g3", "%g4" 80 ); 81 82 while (1); 83 83 } 84 84
Note:
See TracChangeset
for help on using the changeset viewer.