FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/gpf/osl/os_pro_fl.c @ 338:42bc1d7068ac
OSL reconstruction: os_pro_fl.c started
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Fri, 02 May 2014 06:36:17 +0000 |
parents | |
children | 2f88c5b89113 |
comparison
equal
deleted
inserted
replaced
337:a26470040d89 | 338:42bc1d7068ac |
---|---|
1 /* | |
2 * This C module is a reconstruction based on the disassembly of | |
3 * os_pro.obj in frame_na7_db_fl.lib from the Leonardo package. | |
4 */ | |
5 | |
6 /* set of included headers from COFF symtab: */ | |
7 #include <stdio.h> | |
8 #include <string.h> | |
9 #include "gpfconf.h" /* FreeCalypso addition */ | |
10 #include "../../nucleus/nucleus.h" | |
11 #include "typedefs.h" | |
12 #include "os.h" | |
13 #include "gdi.h" | |
14 #include "os_types.h" | |
15 #include "os_glob.h" | |
16 | |
17 typedef unsigned char u_char; | |
18 | |
19 extern T_OS_TASK_TABLE_ENTRY TaskTable[]; | |
20 | |
21 /* .bss */ | |
22 static NU_SEMAPHORE ProSemCB; | |
23 | |
24 static int | |
25 os_GetTaskEntry(USHORT Index, OS_HANDLE *Handle) | |
26 { | |
27 static USHORT Idx; | |
28 | |
29 if (Index == FIRST_ENTRY) | |
30 Idx = 0; | |
31 if (Index == FIRST_ENTRY || Index == NEXT_ENTRY) { | |
32 while (++Idx <= MaxTasks && !TaskTable[Idx].Name[0]) | |
33 ; | |
34 } else | |
35 Idx = Index; | |
36 if (Idx <= MaxTasks && TaskTable[Idx].Name[0]) { | |
37 *Handle = Idx; | |
38 return(0); | |
39 } else | |
40 return(-1); | |
41 } | |
42 | |
43 GLOBAL LONG | |
44 os_TaskInformation(USHORT Index, char *Buffer) | |
45 { | |
46 DATA_ELEMENT TaskStatus; | |
47 OPTION Prio, Preempt; | |
48 UNSIGNED Count, TimeSlice, Size, MinStack; | |
49 OS_HANDLE Handle; | |
50 CHAR Name[NU_MAX_NAME]; | |
51 u_char *StackBase, *sp; | |
52 USHORT Untouched; | |
53 | |
54 if (os_GetTaskEntry(Index, &Handle) < 0) | |
55 return(-1); | |
56 if (NU_Task_Information(&TaskTable[Handle].TaskCB.TCB, Name, | |
57 &TaskStatus, &Count, &Prio, &Preempt, | |
58 &TimeSlice, (VOID **) &StackBase, | |
59 &Size, &MinStack) != NU_SUCCESS) | |
60 return(-1); | |
61 Untouched = 0; | |
62 for (sp = StackBase; sp < StackBase + Size; sp++) { | |
63 if (*sp != 0xFE) | |
64 break; | |
65 Untouched++; | |
66 } | |
67 sprintf(Buffer, | |
68 "Name:%s Stat:%d Count:%ld Prio:%d Stack:%lx Size:%ld Untouched:%d", | |
69 Name, TaskStatus, Count, 255 - Prio, (ULONG) StackBase, | |
70 (ULONG) Size, Untouched); | |
71 return(0); | |
72 } |