Changeset a218709 in mainline for kernel/arch/sparc32/src/userspace.c
- Timestamp:
- 2013-12-02T23:45:45Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2955bb9
- Parents:
- 3bc42bd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc32/src/userspace.c
r3bc42bd ra218709 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);44 // printf("userspace(): entry=%p, stack=%p, stacksize=%d\n", kernel_uarg->uspace_entry, kernel_uarg->uspace_stack, kernel_uarg->uspace_stack_size); 45 45 /* On real hardware this switches the CPU to user 46 46 space mode and jumps to kernel_uarg->uspace_entry. */ 47 47 48 uint32_t l0, l1, l2; 48 49 uint32_t psr = psr_read(); 50 uint8_t wim; 49 51 50 52 psr &= ~(1 << 7); 51 53 psr &= ~(1 << 6); 52 54 55 /* Read invalid window variables */ 56 read_from_invalid(&l0, &l1, &l2); 57 58 /* Make current window invalid */ 59 wim = (psr & 0x7) + 1; 60 wim = (1 << wim) | (1 >> (8 - wim)); 61 53 62 asm volatile ( 54 63 "flush\n" 55 64 "mov %[stack], %%sp\n" 56 "mov %[arg], %%o1\n" 65 "mov %[wim], %%wim\n" 66 "ld %[v0], %%o0\n" 67 "ld %[v1], %%o1\n" 68 "ld %[v2], %%o2\n" 69 "call write_to_invalid\n" 70 "nop\n" 71 "ld %[arg], %%o1\n" 57 72 "jmp %[entry]\n" 58 73 "mov %[psr], %%psr\n" :: [entry] "r" (kernel_uarg->uspace_entry), 59 [arg] " r" (kernel_uarg->uspace_uarg),74 [arg] "m" (kernel_uarg->uspace_uarg), 60 75 [psr] "r" (psr), 61 [stack] "r" (kernel_uarg->uspace_stack + kernel_uarg->uspace_stack_size)); 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"); 62 81 63 82 while (true);
Note:
See TracChangeset
for help on using the changeset viewer.