Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "../drivers.h"
- #include <stdio.h>
- #include "../../kernel/ipc.h"
- #include "../../kernel/config.h"
- #include "../../kernel/type.h"
- FORWARD _PROTOTYPE( char *s_traps_str, (int flags) );
- FORWARD _PROTOTYPE( char *s_flags_str, (int flags) );
- struct boot_image image[NR_BOOT_PROCS];
- void get_bootimage(char *buf, int bufSize) {
- int status, i, m, j;
- struct boot_image *ip;
- static char ipc_to[BITCHUNK_BITS*2];
- status = sys_getimage(image);
- if (status != OK) {
- report("PROC", "warning: couldn't get copy of image table", status);
- *buf = '\0';
- return;
- }
- buf+=sprintf(buf,"---name-- -nr- -flags- -traps- -sq- ----pc- -stack- -ipc_to[0]--------\n");
- for (m=0; m<NR_BOOT_PROCS; m++) {
- ip = &image[m];
- for (i=j=0; i < BITCHUNK_BITS; i++, j++) {
- ipc_to[j] = (ip->ipc_to & (1<<i)) ? '1' : '0';
- if (i % 8 == 7) ipc_to[++j] = ' ';
- }
- ipc_to[j] = '\0';
- buf+=sprintf(buf, "%8s %4d %s %s %3d %7lu %7lu %s\n",
- ip->proc_name, ip->proc_nr,
- s_flags_str(ip->flags), s_traps_str(ip->trap_mask),
- ip->priority, (long)ip->initial_pc, ip->stksize, ipc_to);
- }
- }
- PRIVATE char *s_flags_str(int flags)
- {
- static char str[10];
- str[0] = (flags & PREEMPTIBLE) ? 'P' : '-';
- str[1] = '-';
- str[2] = (flags & BILLABLE) ? 'B' : '-';
- str[3] = (flags & SYS_PROC) ? 'S' : '-';
- str[4] = '-';
- str[5] = '\0';
- return str;
- }
- PRIVATE char *s_traps_str(int flags)
- {
- static char str[10];
- str[0] = (flags & (1 << SEND)) ? 'S' : '-';
- str[1] = (flags & (1 << SENDA)) ? 'A' : '-';
- str[2] = (flags & (1 << RECEIVE)) ? 'R' : '-';
- str[3] = (flags & (1 << SENDREC)) ? 'B' : '-';
- str[4] = (flags & (1 << NOTIFY)) ? 'N' : '-';
- str[5] = '\0';
- return str;
- }
Add Comment
Please, Sign In to add comment