Changeset 626 for trunk/kernel/syscalls
- Timestamp:
- Apr 29, 2019, 7:25:09 PM (6 years ago)
- Location:
- trunk/kernel/syscalls
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/shared_include/shared_almos.h
r623 r626 54 54 DISPLAY_MAPPER = 9, 55 55 DISPLAY_BARRIER = 10, 56 DISPLAY_FAT = 11, 56 57 } 57 58 display_type_t; -
trunk/kernel/syscalls/shared_include/syscalls_numbers.h
r610 r626 2 2 * syscalls_numbers.c - Contains enum of the syscalls. 3 3 * 4 * Author Alain Greiner (201 8)4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 86 86 87 87 SYS_EXIT = 50, 88 SYS_SYNC = 51, 89 SYS_FSYNC = 52, 88 90 89 SYSCALLS_NR = 5 1,91 SYSCALLS_NR = 53, 90 92 91 93 } syscalls_t; -
trunk/kernel/syscalls/sys_barrier.c
r625 r626 104 104 105 105 // copy barrier attributes into kernel space 106 hal_copy_from_uspace( &k_attr , (void*)attr , sizeof(pthread_barrierattr_t) ); 106 hal_copy_from_uspace( local_cxy, 107 &k_attr, 108 (void*)attr, 109 sizeof(pthread_barrierattr_t) ); 107 110 108 111 if ( count != k_attr.x_size * k_attr.y_size *k_attr.nthreads ) -
trunk/kernel/syscalls/sys_display.c
r625 r626 56 56 else if( type == DISPLAY_MAPPER ) return "MAPPER"; 57 57 else if( type == DISPLAY_BARRIER ) return "BARRIER"; 58 else if( type == DISPLAY_FAT ) return "FAT"; 58 59 else return "undefined"; 59 60 } … … 436 437 break; 437 438 } 439 ///////////////// 440 case DISPLAY_FAT: 441 { 442 uint32_t entries = (uint32_t)arg1; 443 444 if( entries > 4096 ) 445 { 446 447 #if DEBUG_SYSCALLS_ERROR 448 printk("\n[ERROR] in %s for FAT : nb_entries larger than 4096\n", 449 __FUNCTION__ ); 450 #endif 451 this->errno = EINVAL; 452 return -1; 453 } 454 455 if( entries == 0 ) // display fat context in cluster cxy 456 { 457 uint32_t cxy = (uint32_t)arg0; 458 459 if( cluster_is_undefined( cxy ) ) 460 { 461 462 #if DEBUG_SYSCALLS_ERROR 463 printk("\n[ERROR] in %s for FAT : illegal cxy argument %x\n", 464 __FUNCTION__ , cxy ); 465 #endif 466 this->errno = EINVAL; 467 return -1; 468 } 469 470 fatfs_display_ctx( cxy ); 471 } 472 else // display nb_entries in page 473 { 474 uint32_t page = (uint32_t)arg0; 475 476 fatfs_display_fat( page , entries ); 477 } 478 479 break; 480 } 438 481 //////// 439 482 default: -
trunk/kernel/syscalls/sys_exec.c
r625 r626 96 96 97 97 // copy the array of pointers to kernel buffer 98 hal_copy_from_uspace( k_pointers, 98 hal_copy_from_uspace( local_cxy, 99 k_pointers, 99 100 u_pointers, 100 101 CONFIG_PPM_PAGE_SIZE ); … … 115 116 116 117 // copy the user string to kernel buffer 117 hal_copy_from_uspace( k_buf_ptr, 118 hal_copy_from_uspace( local_cxy, 119 k_buf_ptr, 118 120 k_pointers[index], 119 121 length ); -
trunk/kernel/syscalls/sys_fsync.c
r1 r626 1 1 /* 2 * sys_fsync : sync file2 * sys_fsync.c - copy all modified pages of a given file mapper to IOC device. 3 3 * 4 * Copyright (c) 2015 UPMC Sorbonne Universites4 * Author Alain Greiner (2016,1017) 5 5 * 6 * This file is part of ALMOS-kernel.6 * Copyright (c) UPMC Sorbonne Universites 7 7 * 8 * ALMOS-kernel is free software; you can redistribute it and/or modify it 8 * This file is part of ALMOS-MKH. 9 * 10 * ALMOS-MKH is free software; you can redistribute it and/or modify it 9 11 * under the terms of the GNU General Public License as published by 10 12 * the Free Software Foundation; version 2.0 of the License. 11 13 * 12 * ALMOS- kernelis distributed in the hope that it will be useful, but14 * ALMOS-MKH is distributed in the hope that it will be useful, but 13 15 * WITHOUT ANY WARRANTY; without even the implied warranty of 14 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU … … 16 18 * 17 19 * You should have received a copy of the GNU General Public License 18 * along with ALMOS- kernel; if not, write to the Free Software Foundation,20 * along with ALMOS-MKH; if not, write to the Free Software Foundation, 19 21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 22 */ 21 23 24 #include <hal_kernel_types.h> 25 #include <vfs.h> 26 #include <process.h> 27 #include <thread.h> 28 #include <printk.h> 22 29 23 #include < types.h>30 #include <syscalls.h> 24 31 25 int sys_fsync (uint_t fd) 32 ///////////////////////////////// 33 int sys_fsync( uint32_t file_id ) 26 34 { 27 //TODO 28 return 0;35 printk("\n[ERROR] in %d : not implemented yet\n", __FUNCTION__, file_id ); 36 return ENOSYS; 29 37 } -
trunk/kernel/syscalls/sys_get_config.c
r625 r626 111 111 112 112 // copy to user space 113 hal_copy_to_uspace( x_size , &k_x_size, sizeof(uint32_t) );114 hal_copy_to_uspace( y_size , &k_y_size, sizeof(uint32_t) );115 hal_copy_to_uspace( ncores , &k_ncores, sizeof(uint32_t) );113 hal_copy_to_uspace( local_cxy, &k_x_size, x_size, sizeof(uint32_t) ); 114 hal_copy_to_uspace( local_cxy, &k_y_size, y_size, sizeof(uint32_t) ); 115 hal_copy_to_uspace( local_cxy, &k_ncores, ncores, sizeof(uint32_t) ); 116 116 117 117 hal_fence(); -
trunk/kernel/syscalls/sys_get_core.c
r625 r626 82 82 83 83 // copy to user space 84 hal_copy_to_uspace( cxy , &k_cxy, sizeof(uint32_t) );85 hal_copy_to_uspace( l id , &k_lid, sizeof(uint32_t) );84 hal_copy_to_uspace( local_cxy, &k_cxy, cxy, sizeof(uint32_t) ); 85 hal_copy_to_uspace( local_cxy, &k_lid, lid, sizeof(uint32_t) ); 86 86 87 87 return 0; -
trunk/kernel/syscalls/sys_get_cycle.c
r625 r626 64 64 65 65 // copy to user space 66 hal_copy_to_uspace( cycle , &k_cycle, sizeof(uint64_t) );66 hal_copy_to_uspace( local_cxy, &k_cycle, cycle, sizeof(uint64_t) ); 67 67 68 68 return 0; -
trunk/kernel/syscalls/sys_is_fg.c
r625 r626 91 91 92 92 // copy to user space 93 hal_copy_to_uspace( is_fg , &is_txt_owner, sizeof(uint32_t) );93 hal_copy_to_uspace( local_cxy, &is_txt_owner, is_fg, sizeof(uint32_t) ); 94 94 95 95 hal_fence(); -
trunk/kernel/syscalls/sys_mmap.c
r625 r626 77 77 78 78 // copy attributes from user space to kernel space 79 hal_copy_from_uspace( &k_attr , attr , sizeof(mmap_attr_t) ); 79 hal_copy_from_uspace( local_cxy, 80 &k_attr, 81 attr, 82 sizeof(mmap_attr_t) ); 80 83 81 84 // get addr, fdid, offset, and length attributes … … 305 308 306 309 // copy vseg base address to user space 307 hal_copy_to_uspace( &attr->addr , &vseg->min , sizeof(intptr_t) ); 308 310 hal_copy_to_uspace( local_cxy, 311 &vseg->min, 312 &attr->addr, 313 sizeof(intptr_t) ); 309 314 hal_fence(); 310 315 -
trunk/kernel/syscalls/sys_opendir.c
r625 r626 175 175 176 176 // set ident value in user buffer 177 hal_copy_to_uspace( dirp , &ident , sizeof(intptr_t) ); 177 hal_copy_to_uspace( local_cxy, 178 &ident, 179 dirp, 180 sizeof(intptr_t) ); 178 181 179 182 hal_fence(); -
trunk/kernel/syscalls/sys_readdir.c
r625 r626 2 2 * sys_readdir.c - Copy one entry from an open VFS directory to an user buffer. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 113 113 114 114 // copy dirent pointer to user buffer 115 hal_copy_to_uspace( buffer, &direntp , sizeof(void *) ); 115 hal_copy_to_uspace( local_cxy, 116 &direntp, 117 buffer, 118 sizeof(void *) ); 116 119 117 120 // update current index in user_dir structure -
trunk/kernel/syscalls/sys_sem.c
r624 r626 139 139 140 140 // return value to user 141 hal_copy_to_uspace( current_value , ¤t , sizeof(uint32_t) ); 141 hal_copy_to_uspace( local_cxy, 142 ¤t, 143 current_value, 144 sizeof(uint32_t) ); 142 145 } 143 146 break; -
trunk/kernel/syscalls/sys_stat.c
r624 r626 122 122 123 123 // copy k_stat to u_stat 124 hal_copy_to_uspace( u_stat , &k_stat , sizeof(struct stat) ); 124 hal_copy_to_uspace( local_cxy, 125 &k_stat, 126 u_stat, 127 sizeof(struct stat) ); 125 128 126 129 hal_fence(); -
trunk/kernel/syscalls/sys_thread_create.c
r624 r626 106 106 } 107 107 108 hal_copy_from_uspace( &kern_attr , user_attr , sizeof(pthread_attr_t) ); 108 hal_copy_from_uspace( local_cxy, 109 &kern_attr, 110 user_attr, 111 sizeof(pthread_attr_t) ); 109 112 } 110 113 … … 212 215 // returns trdid to user space 213 216 trdid = hal_remote_l32( XPTR( child_cxy , &child_ptr->trdid ) ); 214 hal_copy_to_uspace( trdid_ptr , &trdid , sizeof(pthread_t) ); 217 hal_copy_to_uspace( local_cxy, 218 &trdid, 219 trdid_ptr, 220 sizeof(pthread_t) ); 215 221 216 222 // activate new thread -
trunk/kernel/syscalls/sys_timeofday.c
r624 r626 83 83 84 84 // copy values to user space 85 hal_copy_to_uspace( tv , &k_tv , sizeof(struct timeval) ); 85 hal_copy_to_uspace( local_cxy, 86 &k_tv, 87 tv, 88 sizeof(struct timeval) ); 86 89 87 90 hal_fence(); -
trunk/kernel/syscalls/sys_wait.c
r625 r626 154 154 #endif 155 155 // return child termination state to parent process 156 hal_copy_to_uspace( status , &child_state , sizeof(int) ); 156 hal_copy_to_uspace( local_cxy, 157 &child_state, 158 status, 159 sizeof(int) ); 157 160 return child_pid; 158 161 } -
trunk/kernel/syscalls/syscalls.h
r623 r626 2 2 * syscalls.h - Kernel side services for syscall handling. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 584 584 * [43] This debug function displays on the kernel terminal TXT0 an user defined string, 585 585 * or the current state of a kernel structure, identified by the <type> argument. 586 * The <arg0>, <arg1>, and <arg2> arguments depends on the structure type: 587 * - DISPLAY_STRING : an user defined string 588 * - DISPLAY_VMM : VSL and GPT for a process identified by <pid>. 589 * - DISPLAY_SCHED : all threads allocated to a scheduler <cxy> & <lid>. 590 * - DISPLAY_CLUSTER_PROCESS : all processes registered in a cluster identified by <cxy>. 591 * - DISPLAY_TXT_PROCESS : all processes registered in a cluster identified by <cxy>. 592 * - DISPLAY_VFS : all files registered in the VFS cache. 593 * - DISPLAY_CHDEV : all registered channel devices. 594 * - DISPLAY_DQDT : all DQDT nodes curren values. 595 * - DISPLAY_BUSYLOCKS : all busylocks taken by one thread. 596 * - DISPLAY_MAPPER : one page of a given mapper. 586 * The <arg0>, <arg1>, and <arg2> arguments depends on the structure type. 597 587 ****************************************************************************************** 598 588 * type : [in] type of display … … 671 661 672 662 /****************************************************************************************** 673 * [50] This function implements the exitsystem call terminating a POSIX process.663 * [50] This function implements the "exit" system call terminating a POSIX process. 674 664 * It can be called by any thread running in any cluster. 675 665 * It uses both remote accesses to access the owner process descriptor, and the 676 * RPC_PROCESS_SIGACTION to delete remote process and thread descriptors.666 * RPC_PROCESS_SIGACTION to delete remote process copies and thread descriptors. 677 667 * In the present implementation, this function implements actually the _exit(): 678 668 * - it does not flush open output streams. 679 669 * - it does not close open streams. 680 670 ****************************************************************************************** 681 * @ status : terminaison status. 671 * @ status : terminaison status returned to parent process. 672 * @ return 0 if success / return -1 if failure. 682 673 *****************************************************************************************/ 683 674 int sys_exit( uint32_t status ); 684 675 676 /****************************************************************************************** 677 * [51] This function implements the "sync" system call. 678 * It forces all modified pages in all kernel mappers to be copied to the IOC device. 679 * It can be called by any thread running in any cluster. 680 * TODO not implemented yet. 681 ****************************************************************************************** 682 * @ return 0 if success / return -1 if failure. 683 *****************************************************************************************/ 684 int sys_sync( void ); 685 686 /****************************************************************************************** 687 * [52] This function implements the "fsync" system call. 688 * It forces all modified pages of the file mapper identified by the <fd> argument 689 * to be copied to the IOC device. 690 * It can be called by any thread running in any cluster. 691 * TODO not implemented yet. 692 ****************************************************************************************** 693 * @ file_id : file descriptor index in fd_array. 694 * @ return 0 if success / return -1 if failure. 695 *****************************************************************************************/ 696 int sys_fsync( uint32_t file_id ); 697 685 698 #endif // _SYSCALLS_H_
Note: See TracChangeset
for help on using the changeset viewer.