- Timestamp:
- 2018-05-10T13:39:19Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e8975278
- Parents:
- b277bef
- git-author:
- Jiri Svoboda <jiri@…> (2018-05-10 07:38:12)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-05-10 13:39:19)
- Location:
- kernel
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/userspace.c
rb277bef rae7d03c 55 55 56 56 asm volatile ( 57 58 59 60 61 62 57 "pushq %[udata_des]\n" 58 "pushq %[stack_top]\n" 59 "pushq %[rflags]\n" 60 "pushq %[utext_des]\n" 61 "pushq %[entry]\n" 62 "movq %[uarg], %%rax\n" 63 63 64 65 66 67 68 69 70 71 72 73 74 64 /* %rdi is defined to hold pcb_ptr - set it to 0 */ 65 "xorq %%rdi, %%rdi\n" 66 "iretq\n" 67 :: [udata_des] "i" (GDT_SELECTOR(UDATA_DES) | PL_USER), 68 [stack_top] "r" ((uint8_t *) kernel_uarg->uspace_stack + 69 kernel_uarg->uspace_stack_size), 70 [rflags] "r" (rflags), 71 [utext_des] "i" (GDT_SELECTOR(UTEXT_DES) | PL_USER), 72 [entry] "r" (kernel_uarg->uspace_entry), 73 [uarg] "r" (kernel_uarg->uspace_uarg) 74 : "rax" 75 75 ); 76 76 77 77 /* Unreachable */ 78 while (true); 78 while (true) 79 ; 79 80 } 80 81 -
kernel/arch/arm32/src/cpu/cpu.c
rb277bef rae7d03c 169 169 #endif 170 170 #ifdef PROCESSOR_ARCH_armv7_a 171 172 173 174 175 176 171 /* ICache coherency is elaborated on in barrier.h. 172 * VIPT and PIPT caches need maintenance only on code modify, 173 * so it should be safe for general use. 174 * Enable branch predictors too as they follow the same rules 175 * as ICache and they can be flushed together 176 */ 177 177 if ((CTR_read() & CTR_L1I_POLICY_MASK) != CTR_L1I_POLICY_AIVIVT) { 178 178 control_reg |= -
kernel/arch/arm32/src/exception.c
rb277bef rae7d03c 68 68 /* relative address (related to exc. vector) of the word 69 69 * where handler's address is stored 70 */70 */ 71 71 volatile uint32_t handler_address_ptr = EXC_VECTORS_SIZE - 72 72 PREFETCH_OFFSET; -
kernel/arch/arm32/src/mach/beagleboardxm/beagleboardxm.c
rb277bef rae7d03c 88 88 amdm37x_gpt_irq_ack(&beagleboard.timer); 89 89 90 91 92 93 90 /* 91 * We are holding a lock which prevents preemption. 92 * Release the lock, call clock() and reacquire the lock again. 93 */ 94 94 spinlock_unlock(&irq->lock); 95 95 clock(); -
kernel/arch/arm32/src/mach/integratorcp/integratorcp.c
rb277bef rae7d03c 193 193 { 194 194 /* 195 * We are holding a lock which prevents preemption.196 * Release the lock, call clock() and reacquire the lock again.197 */195 * We are holding a lock which prevents preemption. 196 * Release the lock, call clock() and reacquire the lock again. 197 */ 198 198 199 199 spinlock_unlock(&irq->lock); -
kernel/arch/ia32/src/userspace.c
rb277bef rae7d03c 53 53 54 54 asm volatile ( 55 56 55 /* Set up GS register (virtual register segment) */ 56 "movl %[vreg_des], %%gs\n" 57 57 58 59 60 61 62 63 58 "pushl %[udata_des]\n" 59 "pushl %[stack_top]\n" 60 "pushl %[eflags]\n" 61 "pushl %[utext_des]\n" 62 "pushl %[entry]\n" 63 "movl %[uarg], %%eax\n" 64 64 65 66 65 /* %edi is defined to hold pcb_ptr - set it to 0 */ 66 "xorl %%edi, %%edi\n" 67 67 68 69 70 71 72 73 74 75 76 77 78 79 68 "iret\n" 69 : 70 : [eflags_mask] "i" (~EFLAGS_NT), 71 [udata_des] "i" (GDT_SELECTOR(UDATA_DES) | PL_USER), 72 [stack_top] "r" ((uint8_t *) kernel_uarg->uspace_stack + 73 kernel_uarg->uspace_stack_size), 74 [eflags] "r" ((eflags & ~(EFLAGS_NT)) | EFLAGS_IF), 75 [utext_des] "i" (GDT_SELECTOR(UTEXT_DES) | PL_USER), 76 [entry] "r" (kernel_uarg->uspace_entry), 77 [uarg] "r" (kernel_uarg->uspace_uarg), 78 [vreg_des] "r" (GDT_SELECTOR(VREG_DES)) 79 : "eax"); 80 80 81 81 /* Unreachable */ 82 while (true); 82 while (true) 83 ; 83 84 } 84 85 -
kernel/arch/ia64/include/arch/mm/vhpt.h
rb277bef rae7d03c 31 31 */ 32 32 /** @file 33 */33 */ 34 34 35 35 #ifndef KERN_ia64_VHPT_H_ -
kernel/arch/ia64/src/mm/vhpt.c
rb277bef rae7d03c 1 1 /* 2 * Copyright (c) 2006 Jakub Vana3 * All rights reserved.4 *5 * Redistribution and use in source and binary forms, with or without6 * modification, are permitted provided that the following conditions7 * are met:8 *9 * - Redistributions of source code must retain the above copyright10 * notice, this list of conditions and the following disclaimer.11 * - Redistributions in binary form must reproduce the above copyright12 * notice, this list of conditions and the following disclaimer in the13 * documentation and/or other materials provided with the distribution.14 * - The name of the author may not be used to endorse or promote products15 * derived from this software without specific prior written permission.16 *17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.2 * Copyright (c) 2006 Jakub Vana 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 … … 31 31 */ 32 32 /** @file 33 */33 */ 34 34 35 35 #include <mem.h> -
kernel/generic/src/cpu/cpu.c
rb277bef rae7d03c 1 1 /* 2 2 * Copyright (c) 2001-2004 Jakub Jermar 3 3 * All rights reserved. -
kernel/generic/src/log/log.c
rb277bef rae7d03c 63 63 64 64 /** Kernel log initialized */ 65 static atomic_t log_inited = { false};65 static atomic_t log_inited = { false }; 66 66 67 67 /** Position in the cyclic buffer where the first log entry starts */ … … 97 97 } 98 98 99 static size_t log_copy_from(uint8_t *data, size_t pos, size_t len) { 99 static size_t log_copy_from(uint8_t *data, size_t pos, size_t len) 100 { 100 101 for (size_t i = 0; i < len; i++, pos = (pos + 1) % LOG_LENGTH) { 101 102 data[i] = log_buffer[pos]; … … 104 105 } 105 106 106 static size_t log_copy_to(const uint8_t *data, size_t pos, size_t len) { 107 static size_t log_copy_to(const uint8_t *data, size_t pos, size_t len) 108 { 107 109 for (size_t i = 0; i < len; i++, pos = (pos + 1) % LOG_LENGTH) { 108 110 log_buffer[pos] = data[i]; … … 170 172 * This releases the log and output buffer locks. 171 173 */ 172 void log_end(void) { 174 void log_end(void) 175 { 173 176 /* Set the length in the header to correct value */ 174 177 log_copy_to((uint8_t *) &log_current_len, log_current_start, sizeof(size_t)); … … 303 306 304 307 switch (operation) { 305 case KLOG_WRITE: 306 data = (char *) malloc(size + 1, 0); 307 if (!data) 308 return (sys_errno_t) ENOMEM; 309 310 rc = copy_from_uspace(data, buf, size); 311 if (rc) { 312 free(data); 313 return (sys_errno_t) rc; 308 case KLOG_WRITE: 309 data = (char *) malloc(size + 1, 0); 310 if (!data) 311 return (sys_errno_t) ENOMEM; 312 313 rc = copy_from_uspace(data, buf, size); 314 if (rc) { 315 free(data); 316 return (sys_errno_t) rc; 317 } 318 data[size] = 0; 319 320 if (level >= LVL_LIMIT) 321 level = LVL_NOTE; 322 323 log(LF_USPACE, level, "%s", data); 324 325 free(data); 326 return EOK; 327 case KLOG_READ: 328 data = (char *) malloc(size, 0); 329 if (!data) 330 return (sys_errno_t) ENOMEM; 331 332 size_t entry_len = 0; 333 size_t copied = 0; 334 335 rc = EOK; 336 337 spinlock_lock(&log_lock); 338 339 while (next_for_uspace < log_used) { 340 size_t pos = (log_start + next_for_uspace) % LOG_LENGTH; 341 log_copy_from((uint8_t *) &entry_len, pos, sizeof(size_t)); 342 343 if (entry_len > PAGE_SIZE) { 344 /* 345 * Since we limit data transfer 346 * to uspace to a maximum of PAGE_SIZE 347 * bytes, skip any entries larger 348 * than this limit to prevent 349 * userspace being stuck trying to 350 * read them. 351 */ 352 next_for_uspace += entry_len; 353 continue; 314 354 } 315 data[size] = 0; 316 317 if (level >= LVL_LIMIT) 318 level = LVL_NOTE; 319 320 log(LF_USPACE, level, "%s", data); 321 355 356 if (size < copied + entry_len) { 357 if (copied == 0) 358 rc = EOVERFLOW; 359 break; 360 } 361 362 log_copy_from((uint8_t *) (data + copied), pos, entry_len); 363 copied += entry_len; 364 next_for_uspace += entry_len; 365 } 366 367 spinlock_unlock(&log_lock); 368 369 if (rc != EOK) { 322 370 free(data); 323 return EOK; 324 case KLOG_READ: 325 data = (char *) malloc(size, 0); 326 if (!data) 327 return (sys_errno_t) ENOMEM; 328 329 size_t entry_len = 0; 330 size_t copied = 0; 331 332 rc = EOK; 333 334 spinlock_lock(&log_lock); 335 336 while (next_for_uspace < log_used) { 337 size_t pos = (log_start + next_for_uspace) % LOG_LENGTH; 338 log_copy_from((uint8_t *) &entry_len, pos, sizeof(size_t)); 339 340 if (entry_len > PAGE_SIZE) { 341 /* 342 * Since we limit data transfer 343 * to uspace to a maximum of PAGE_SIZE 344 * bytes, skip any entries larger 345 * than this limit to prevent 346 * userspace being stuck trying to 347 * read them. 348 */ 349 next_for_uspace += entry_len; 350 continue; 351 } 352 353 if (size < copied + entry_len) { 354 if (copied == 0) 355 rc = EOVERFLOW; 356 break; 357 } 358 359 log_copy_from((uint8_t *) (data + copied), pos, entry_len); 360 copied += entry_len; 361 next_for_uspace += entry_len; 362 } 363 364 spinlock_unlock(&log_lock); 365 366 if (rc != EOK) { 367 free(data); 368 return (sys_errno_t) rc; 369 } 370 371 rc = copy_to_uspace(buf, data, size); 372 373 free(data); 374 375 if (rc != EOK) 376 return (sys_errno_t) rc; 377 378 return copy_to_uspace(uspace_nread, &copied, sizeof(copied)); 379 return EOK; 380 default: 381 return (sys_errno_t) ENOTSUP; 371 return (sys_errno_t) rc; 372 } 373 374 rc = copy_to_uspace(buf, data, size); 375 376 free(data); 377 378 if (rc != EOK) 379 return (sys_errno_t) rc; 380 381 return copy_to_uspace(uspace_nread, &copied, sizeof(copied)); 382 return EOK; 383 default: 384 return (sys_errno_t) ENOTSUP; 382 385 } 383 386 } -
kernel/generic/src/mm/as.c
rb277bef rae7d03c 641 641 642 642 /* 643 644 645 646 643 * Create the sharing info structure. 644 * We do this in advance for every new area, even if it is not going 645 * to be shared. 646 */ 647 647 if (!(attrs & AS_AREA_ATTR_PARTIAL)) { 648 648 si = (share_info_t *) malloc(sizeof(share_info_t), 0); -
kernel/generic/src/proc/task.c
rb277bef rae7d03c 572 572 * The notification is always available, but unless udebug is enabled, 573 573 * that's all you get. 574 */574 */ 575 575 if (notify) { 576 576 /* Notify the subscriber that a fault occurred. */
Note:
See TracChangeset
for help on using the changeset viewer.