source: trunk/kernel/syscalls/sys_trace.c @ 194

Last change on this file since 194 was 124, checked in by max@…, 7 years ago

rename hal_wbflush->hal_fence

File size: 2.0 KB
RevLine 
[1]1/*
[23]2 * sys_trace.c - show kernel active processes and threads
[1]3 *
[23]4 * Author    Alain Greiner (c) (2016,2017)
[1]5 *
[23]6 * Copyright (c) UPMC Sorbonne Universites
[1]7 *
[23]8 * This file is part of ALMOS-MKH.
9 *
10 * ALMOS-MKH is free software; you can redistribute it and/or modify it
[1]11 * under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; version 2.0 of the License.
13 *
[23]14 * ALMOS-MKH is distributed in the hope that it will be useful, but
[1]15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
[23]20 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
[1]21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
[23]24#include <hal_types.h>
25#include <hal_special.h>
26#include <printk.h>
[1]27#include <thread.h>
28#include <errno.h>
[23]29#include <syscalls.h>
[1]30
[23]31//////////////////////////////////
32int sys_trace( uint32_t operation,
33               pid_t    pid, 
34               uint32_t trdid )
[1]35{
[23]36    // get extended pointer on target thread
37    xptr_t thread_xp = thread_get_xptr( pid , trdid );
[1]38
[23]39    if( thread_xp == XPTR_NULL )
40    {
41        printk("\n[ERROR] in %s : undefined thread for PID = %x / TRDID = %x\n",
42               __FUNCTION__ , pid , trdid );
43        CURRENT_THREAD->errno = EINVAL;
44        return -1;
45    }
[1]46
[23]47    if( operation == TRACE_OFF )
48    {
49        // desactivate thread trace TODO
[1]50
[23]51            printk("\n[INFO] %s : trace OFF  for thread %x in process %x\n",
52               __FUNCTION__ , trdid , pid );
53    }
54    else if( operation == TRACE_ON )
55    {
56        // activate thread trace TODO
57                   
58            printk("\n[INFO] %s : trace ON for thread %x in process %x\n",
59               __FUNCTION__ , trdid , pid );
60    }
61    else
62    {
63        printk("\n[ERROR] in %s : undefined operation\n", __FUNCTION__ );
64        CURRENT_THREAD->errno = EINVAL;
65        return -1;
66    }
[1]67
[124]68    hal_fence();
[1]69
[23]70    return 0;
[1]71
[23]72}  // end sys_trace()
Note: See TracBrowser for help on using the repository browser.