mirror of
https://github.com/drasko/codezero.git
synced 2026-03-03 19:13:17 +01:00
Capability print functions shifted to l4lib and various capability.h
cleaned
This commit is contained in:
@@ -1,12 +0,0 @@
|
|||||||
#ifndef __UART_SERVICE_CAPABILITY_H__
|
|
||||||
#define __UART_SERVICE_CAPABILITY_H__
|
|
||||||
|
|
||||||
#include <l4lib/capability.h>
|
|
||||||
#include <l4/api/capability.h>
|
|
||||||
#include <l4/generic/cap-types.h>
|
|
||||||
|
|
||||||
void cap_print(struct capability *cap);
|
|
||||||
void cap_list_print(struct cap_list *cap_list);
|
|
||||||
int cap_read_all();
|
|
||||||
|
|
||||||
#endif /* header */
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <l4/api/errno.h>
|
#include <l4/api/errno.h>
|
||||||
|
|
||||||
#include <l4/api/space.h>
|
#include <l4/api/space.h>
|
||||||
#include <capability.h>
|
#include <l4lib/capability/cap_print.h>
|
||||||
#include <container.h>
|
#include <container.h>
|
||||||
#include <pl110_clcd.h> /* FIXME: Its best if this is <libdev/uart/pl011.h> */
|
#include <pl110_clcd.h> /* FIXME: Its best if this is <libdev/uart/pl011.h> */
|
||||||
#include <linker.h>
|
#include <linker.h>
|
||||||
@@ -28,7 +28,7 @@ int cap_read_all()
|
|||||||
|
|
||||||
/* Read number of capabilities */
|
/* Read number of capabilities */
|
||||||
if ((err = l4_capability_control(CAP_CONTROL_NCAPS,
|
if ((err = l4_capability_control(CAP_CONTROL_NCAPS,
|
||||||
0, 0, 0, &ncaps)) < 0) {
|
0, &ncaps)) < 0) {
|
||||||
printf("l4_capability_control() reading # of"
|
printf("l4_capability_control() reading # of"
|
||||||
" capabilities failed.\n Could not "
|
" capabilities failed.\n Could not "
|
||||||
"complete CAP_CONTROL_NCAPS request.\n");
|
"complete CAP_CONTROL_NCAPS request.\n");
|
||||||
@@ -38,7 +38,7 @@ int cap_read_all()
|
|||||||
|
|
||||||
/* Read all capabilities */
|
/* Read all capabilities */
|
||||||
if ((err = l4_capability_control(CAP_CONTROL_READ,
|
if ((err = l4_capability_control(CAP_CONTROL_READ,
|
||||||
0, 0, 0, caparray)) < 0) {
|
0, caparray)) < 0) {
|
||||||
printf("l4_capability_control() reading of "
|
printf("l4_capability_control() reading of "
|
||||||
"capabilities failed.\n Could not "
|
"capabilities failed.\n Could not "
|
||||||
"complete CAP_CONTROL_READ_CAPS request.\n");
|
"complete CAP_CONTROL_READ_CAPS request.\n");
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef __CAPABILITY_H__
|
|
||||||
#define __CAPABILITY_H__
|
|
||||||
|
|
||||||
#include <l4/api/capability.h>
|
|
||||||
#include <l4/generic/capability.h>
|
|
||||||
#include <l4/generic/cap-types.h>
|
|
||||||
|
|
||||||
void capability_print(struct capability *cap);
|
|
||||||
|
|
||||||
int caps_read_all();
|
|
||||||
|
|
||||||
#endif /* __CAPABILITY_H__ */
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef __UART_SERVICE_CAPABILITY_H__
|
|
||||||
#define __UART_SERVICE_CAPABILITY_H__
|
|
||||||
|
|
||||||
#include <l4lib/capability.h>
|
|
||||||
#include <l4/api/capability.h>
|
|
||||||
#include <l4/generic/cap-types.h>
|
|
||||||
|
|
||||||
void cap_print(struct capability *cap);
|
|
||||||
void cap_list_print(struct cap_list *cap_list);
|
|
||||||
int cap_read_all();
|
|
||||||
|
|
||||||
#endif /* header */
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <l4/api/space.h>
|
#include <l4/api/space.h>
|
||||||
#include <malloc/malloc.h>
|
#include <malloc/malloc.h>
|
||||||
#include <capability.h>
|
#include <l4lib/capability/cap_print.h>
|
||||||
#include <container.h>
|
#include <container.h>
|
||||||
#include "sp804_timer.h"
|
#include "sp804_timer.h"
|
||||||
#include <linker.h>
|
#include <linker.h>
|
||||||
@@ -26,112 +26,6 @@ static int total_caps = 0;
|
|||||||
|
|
||||||
struct capability timer_cap[TIMERS_TOTAL];
|
struct capability timer_cap[TIMERS_TOTAL];
|
||||||
|
|
||||||
|
|
||||||
void cap_dev_print(struct capability *cap)
|
|
||||||
{
|
|
||||||
switch (cap_devtype(cap)) {
|
|
||||||
case CAP_DEVTYPE_UART:
|
|
||||||
printf("Device type:\t\t\t%s%d\n", "UART", cap_devnum(cap));
|
|
||||||
break;
|
|
||||||
case CAP_DEVTYPE_TIMER:
|
|
||||||
printf("Device type:\t\t\t%s%d\n", "Timer", cap_devnum(cap));
|
|
||||||
break;
|
|
||||||
case CAP_DEVTYPE_CLCD:
|
|
||||||
printf("Device type:\t\t\t%s%d\n", "CLCD", cap_devnum(cap));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
printf("Device Irq:\t\t%d\n", cap->irq);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cap_print(struct capability *cap)
|
|
||||||
{
|
|
||||||
printf("Capability id:\t\t\t%d\n", cap->capid);
|
|
||||||
printf("Capability resource id:\t\t%d\n", cap->resid);
|
|
||||||
printf("Capability owner id:\t\t%d\n",cap->owner);
|
|
||||||
|
|
||||||
switch (cap_type(cap)) {
|
|
||||||
case CAP_TYPE_TCTRL:
|
|
||||||
printf("Capability type:\t\t%s\n", "Thread Control");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_EXREGS:
|
|
||||||
printf("Capability type:\t\t%s\n", "Exchange Registers");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_MAP_PHYSMEM:
|
|
||||||
if (!cap_is_devmem(cap)) {
|
|
||||||
printf("Capability type:\t\t%s\n", "Map/Physmem");
|
|
||||||
} else {
|
|
||||||
printf("Capability type:\t\t%s\n", "Map/Physmem/Device");
|
|
||||||
cap_dev_print(cap);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_MAP_VIRTMEM:
|
|
||||||
printf("Capability type:\t\t%s\n", "Map/Virtmem");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_IPC:
|
|
||||||
printf("Capability type:\t\t%s\n", "Ipc");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_UMUTEX:
|
|
||||||
printf("Capability type:\t\t%s\n", "Mutex");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_IRQCTRL:
|
|
||||||
printf("Capability type:\t\t%s\n", "IRQ Control");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_QUANTITY:
|
|
||||||
printf("Capability type:\t\t%s\n", "Quantitative");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("Capability type:\t\t%s\n", "Unknown");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (cap_rtype(cap)) {
|
|
||||||
case CAP_RTYPE_THREAD:
|
|
||||||
printf("Capability resource type:\t%s\n", "Thread");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_SPACE:
|
|
||||||
printf("Capability resource type:\t%s\n", "Space");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_CONTAINER:
|
|
||||||
printf("Capability resource type:\t%s\n", "Container");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_THREADPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Thread Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_SPACEPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Space Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_MUTEXPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Mutex Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_MAPPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Map Pool (PMDS)");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_CPUPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Cpu Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_CAPPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Capability Pool");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("Capability resource type:\t%s\n", "Unknown");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void cap_array_print()
|
|
||||||
{
|
|
||||||
printf("Capabilities\n"
|
|
||||||
"~~~~~~~~~~~~\n");
|
|
||||||
|
|
||||||
for (int i = 0; i < total_caps; i++)
|
|
||||||
cap_print(&caparray[i]);
|
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
int cap_read_all()
|
int cap_read_all()
|
||||||
{
|
{
|
||||||
int ncaps;
|
int ncaps;
|
||||||
@@ -139,7 +33,7 @@ int cap_read_all()
|
|||||||
|
|
||||||
/* Read number of capabilities */
|
/* Read number of capabilities */
|
||||||
if ((err = l4_capability_control(CAP_CONTROL_NCAPS,
|
if ((err = l4_capability_control(CAP_CONTROL_NCAPS,
|
||||||
0, 0, 0, &ncaps)) < 0) {
|
0, &ncaps)) < 0) {
|
||||||
printf("l4_capability_control() reading # of"
|
printf("l4_capability_control() reading # of"
|
||||||
" capabilities failed.\n Could not "
|
" capabilities failed.\n Could not "
|
||||||
"complete CAP_CONTROL_NCAPS request.\n");
|
"complete CAP_CONTROL_NCAPS request.\n");
|
||||||
@@ -149,15 +43,14 @@ int cap_read_all()
|
|||||||
|
|
||||||
/* Read all capabilities */
|
/* Read all capabilities */
|
||||||
if ((err = l4_capability_control(CAP_CONTROL_READ,
|
if ((err = l4_capability_control(CAP_CONTROL_READ,
|
||||||
0, 0, 0, caparray)) < 0) {
|
0, caparray)) < 0) {
|
||||||
printf("l4_capability_control() reading of "
|
printf("l4_capability_control() reading of "
|
||||||
"capabilities failed.\n Could not "
|
"capabilities failed.\n Could not "
|
||||||
"complete CAP_CONTROL_READ_CAPS request.\n");
|
"complete CAP_CONTROL_READ_CAPS request.\n");
|
||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
#if 0
|
//cap_array_print(total_caps, caparray);
|
||||||
cap_array_print(&caparray);
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
#ifndef __UART_SERVICE_CAPABILITY_H__
|
|
||||||
#define __UART_SERVICE_CAPABILITY_H__
|
|
||||||
|
|
||||||
#include <l4lib/capability.h>
|
|
||||||
#include <l4/api/capability.h>
|
|
||||||
#include <l4/generic/cap-types.h>
|
|
||||||
|
|
||||||
void cap_print(struct capability *cap);
|
|
||||||
void cap_list_print(struct cap_list *cap_list);
|
|
||||||
int cap_read_all();
|
|
||||||
|
|
||||||
#endif /* header */
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <l4/api/errno.h>
|
#include <l4/api/errno.h>
|
||||||
|
|
||||||
#include <l4/api/space.h>
|
#include <l4/api/space.h>
|
||||||
#include <capability.h>
|
#include <l4lib/capability/cap_print.h>
|
||||||
#include <container.h>
|
#include <container.h>
|
||||||
#include <pl011_uart.h> /* FIXME: Its best if this is <libdev/uart/pl011.h> */
|
#include <pl011_uart.h> /* FIXME: Its best if this is <libdev/uart/pl011.h> */
|
||||||
#include <linker.h>
|
#include <linker.h>
|
||||||
@@ -21,111 +21,6 @@ static int total_caps = 0;
|
|||||||
|
|
||||||
struct capability uart_cap[UARTS_TOTAL];
|
struct capability uart_cap[UARTS_TOTAL];
|
||||||
|
|
||||||
void cap_dev_print(struct capability *cap)
|
|
||||||
{
|
|
||||||
switch (cap_devtype(cap)) {
|
|
||||||
case CAP_DEVTYPE_UART:
|
|
||||||
printf("Device type:\t\t\t%s%d\n", "UART", cap_devnum(cap));
|
|
||||||
break;
|
|
||||||
case CAP_DEVTYPE_TIMER:
|
|
||||||
printf("Device type:\t\t\t%s%d\n", "Timer", cap_devnum(cap));
|
|
||||||
break;
|
|
||||||
case CAP_DEVTYPE_CLCD:
|
|
||||||
printf("Device type:\t\t\t%s%d\n", "CLCD", cap_devnum(cap));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
printf("Device Irq:\t\t%d\n", cap->irq);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cap_print(struct capability *cap)
|
|
||||||
{
|
|
||||||
printf("Capability id:\t\t\t%d\n", cap->capid);
|
|
||||||
printf("Capability resource id:\t\t%d\n", cap->resid);
|
|
||||||
printf("Capability owner id:\t\t%d\n",cap->owner);
|
|
||||||
|
|
||||||
switch (cap_type(cap)) {
|
|
||||||
case CAP_TYPE_TCTRL:
|
|
||||||
printf("Capability type:\t\t%s\n", "Thread Control");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_EXREGS:
|
|
||||||
printf("Capability type:\t\t%s\n", "Exchange Registers");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_MAP_PHYSMEM:
|
|
||||||
if (!cap_is_devmem(cap)) {
|
|
||||||
printf("Capability type:\t\t%s\n", "Map/Physmem");
|
|
||||||
} else {
|
|
||||||
printf("Capability type:\t\t%s\n", "Map/Physmem/Device");
|
|
||||||
cap_dev_print(cap);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_MAP_VIRTMEM:
|
|
||||||
printf("Capability type:\t\t%s\n", "Map/Virtmem");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_IPC:
|
|
||||||
printf("Capability type:\t\t%s\n", "Ipc");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_UMUTEX:
|
|
||||||
printf("Capability type:\t\t%s\n", "Mutex");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_IRQCTRL:
|
|
||||||
printf("Capability type:\t\t%s\n", "IRQ Control");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_QUANTITY:
|
|
||||||
printf("Capability type:\t\t%s\n", "Quantitative");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("Capability type:\t\t%s\n", "Unknown");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (cap_rtype(cap)) {
|
|
||||||
case CAP_RTYPE_THREAD:
|
|
||||||
printf("Capability resource type:\t%s\n", "Thread");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_SPACE:
|
|
||||||
printf("Capability resource type:\t%s\n", "Space");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_CONTAINER:
|
|
||||||
printf("Capability resource type:\t%s\n", "Container");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_THREADPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Thread Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_SPACEPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Space Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_MUTEXPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Mutex Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_MAPPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Map Pool (PMDS)");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_CPUPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Cpu Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_CAPPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Capability Pool");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("Capability resource type:\t%s\n", "Unknown");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void cap_array_print()
|
|
||||||
{
|
|
||||||
printf("Capabilities\n"
|
|
||||||
"~~~~~~~~~~~~\n");
|
|
||||||
|
|
||||||
for (int i = 0; i < total_caps; i++)
|
|
||||||
cap_print(&caparray[i]);
|
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
int cap_read_all()
|
int cap_read_all()
|
||||||
{
|
{
|
||||||
int ncaps;
|
int ncaps;
|
||||||
@@ -133,7 +28,7 @@ int cap_read_all()
|
|||||||
|
|
||||||
/* Read number of capabilities */
|
/* Read number of capabilities */
|
||||||
if ((err = l4_capability_control(CAP_CONTROL_NCAPS,
|
if ((err = l4_capability_control(CAP_CONTROL_NCAPS,
|
||||||
0, 0, 0, &ncaps)) < 0) {
|
0, &ncaps)) < 0) {
|
||||||
printf("l4_capability_control() reading # of"
|
printf("l4_capability_control() reading # of"
|
||||||
" capabilities failed.\n Could not "
|
" capabilities failed.\n Could not "
|
||||||
"complete CAP_CONTROL_NCAPS request.\n");
|
"complete CAP_CONTROL_NCAPS request.\n");
|
||||||
@@ -143,16 +38,14 @@ int cap_read_all()
|
|||||||
|
|
||||||
/* Read all capabilities */
|
/* Read all capabilities */
|
||||||
if ((err = l4_capability_control(CAP_CONTROL_READ,
|
if ((err = l4_capability_control(CAP_CONTROL_READ,
|
||||||
0, 0, 0, caparray)) < 0) {
|
0, caparray)) < 0) {
|
||||||
printf("l4_capability_control() reading of "
|
printf("l4_capability_control() reading of "
|
||||||
"capabilities failed.\n Could not "
|
"capabilities failed.\n Could not "
|
||||||
"complete CAP_CONTROL_READ_CAPS request.\n");
|
"complete CAP_CONTROL_READ_CAPS request.\n");
|
||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
cap_array_print(&caparray);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
//cap_array_print(total_caps, caparray);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ env = Environment(CC = config.user_toolchain + 'gcc',
|
|||||||
ASFLAGS = ['-D__ASSEMBLY__'],
|
ASFLAGS = ['-D__ASSEMBLY__'],
|
||||||
ENV = {'PATH' : os.environ['PATH']},
|
ENV = {'PATH' : os.environ['PATH']},
|
||||||
LIBS = 'gcc',
|
LIBS = 'gcc',
|
||||||
CPPPATH = ['include', 'include/l4lib/arch', join(PROJROOT, 'include') ])
|
CPPPATH = ['include', 'include/l4lib/arch', join(PROJROOT, 'include')])
|
||||||
|
|
||||||
env.Append(CPPPATH = [LIBMEM_DIR])
|
env.Append(CPPPATH = [LIBMEM_DIR])
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ def create_symlinks(arch):
|
|||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
|
||||||
#create_symlinks(arch)
|
#create_symlinks(arch)
|
||||||
objects = env.StaticObject(Glob('src/*.c') + Glob('src/thread/*.c') + Glob('src/' + arch + '/*.[cS]'))
|
objects = env.StaticObject(Glob('src/*.c') + Glob('src/thread/*.c') + Glob('src/' + arch + '/*.[cS]') + Glob('src/capability/*c'))
|
||||||
library = env.StaticLibrary('l4', objects)
|
library = env.StaticLibrary('l4', objects)
|
||||||
|
|
||||||
Return('library')
|
Return('library')
|
||||||
|
|||||||
12
conts/libl4/include/l4lib/capability/cap_print.h
Normal file
12
conts/libl4/include/l4lib/capability/cap_print.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
#ifndef __CAP_PRINT_H__
|
||||||
|
#define __CAP_PRINT_H__
|
||||||
|
|
||||||
|
#include <l4/api/capability.h>
|
||||||
|
#include <l4/generic/cap-types.h>
|
||||||
|
|
||||||
|
void cap_dev_print(struct capability *cap);
|
||||||
|
void cap_print(struct capability *cap);
|
||||||
|
void cap_array_print(int total_caps, struct capability *caparray);
|
||||||
|
|
||||||
|
#endif /* __CAP_PRINT_H__*/
|
||||||
111
conts/libl4/src/capability/cap_print.c
Normal file
111
conts/libl4/src/capability/cap_print.c
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
|
||||||
|
|
||||||
|
/* Capability printing generic routines */
|
||||||
|
|
||||||
|
#include <l4lib/capability/cap_print.h>
|
||||||
|
|
||||||
|
void cap_dev_print(struct capability *cap)
|
||||||
|
{
|
||||||
|
switch (cap_devtype(cap)) {
|
||||||
|
case CAP_DEVTYPE_UART:
|
||||||
|
printf("Device type:\t\t\t%s%d\n", "UART", cap_devnum(cap));
|
||||||
|
break;
|
||||||
|
case CAP_DEVTYPE_TIMER:
|
||||||
|
printf("Device type:\t\t\t%s%d\n", "Timer", cap_devnum(cap));
|
||||||
|
break;
|
||||||
|
case CAP_DEVTYPE_CLCD:
|
||||||
|
printf("Device type:\t\t\t%s%d\n", "CLCD", cap_devnum(cap));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
printf("Device Irq:\t\t%d\n", cap->irq);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cap_print(struct capability *cap)
|
||||||
|
{
|
||||||
|
printf("Capability id:\t\t\t%d\n", cap->capid);
|
||||||
|
printf("Capability resource id:\t\t%d\n", cap->resid);
|
||||||
|
printf("Capability owner id:\t\t%d\n",cap->owner);
|
||||||
|
|
||||||
|
switch (cap_type(cap)) {
|
||||||
|
case CAP_TYPE_TCTRL:
|
||||||
|
printf("Capability type:\t\t%s\n", "Thread Control");
|
||||||
|
break;
|
||||||
|
case CAP_TYPE_EXREGS:
|
||||||
|
printf("Capability type:\t\t%s\n", "Exchange Registers");
|
||||||
|
break;
|
||||||
|
case CAP_TYPE_MAP_PHYSMEM:
|
||||||
|
if (!cap_is_devmem(cap)) {
|
||||||
|
printf("Capability type:\t\t%s\n", "Map/Physmem");
|
||||||
|
} else {
|
||||||
|
printf("Capability type:\t\t%s\n", "Map/Physmem/Device");
|
||||||
|
cap_dev_print(cap);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CAP_TYPE_MAP_VIRTMEM:
|
||||||
|
printf("Capability type:\t\t%s\n", "Map/Virtmem");
|
||||||
|
break;
|
||||||
|
case CAP_TYPE_IPC:
|
||||||
|
printf("Capability type:\t\t%s\n", "Ipc");
|
||||||
|
break;
|
||||||
|
case CAP_TYPE_UMUTEX:
|
||||||
|
printf("Capability type:\t\t%s\n", "Mutex");
|
||||||
|
break;
|
||||||
|
case CAP_TYPE_IRQCTRL:
|
||||||
|
printf("Capability type:\t\t%s\n", "IRQ Control");
|
||||||
|
break;
|
||||||
|
case CAP_TYPE_QUANTITY:
|
||||||
|
printf("Capability type:\t\t%s\n", "Quantitative");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("Capability type:\t\t%s\n", "Unknown");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (cap_rtype(cap)) {
|
||||||
|
case CAP_RTYPE_THREAD:
|
||||||
|
printf("Capability resource type:\t%s\n", "Thread");
|
||||||
|
break;
|
||||||
|
case CAP_RTYPE_SPACE:
|
||||||
|
printf("Capability resource type:\t%s\n", "Space");
|
||||||
|
break;
|
||||||
|
case CAP_RTYPE_CONTAINER:
|
||||||
|
printf("Capability resource type:\t%s\n", "Container");
|
||||||
|
break;
|
||||||
|
case CAP_RTYPE_THREADPOOL:
|
||||||
|
printf("Capability resource type:\t%s\n", "Thread Pool");
|
||||||
|
break;
|
||||||
|
case CAP_RTYPE_SPACEPOOL:
|
||||||
|
printf("Capability resource type:\t%s\n", "Space Pool");
|
||||||
|
break;
|
||||||
|
case CAP_RTYPE_MUTEXPOOL:
|
||||||
|
printf("Capability resource type:\t%s\n", "Mutex Pool");
|
||||||
|
break;
|
||||||
|
case CAP_RTYPE_MAPPOOL:
|
||||||
|
printf("Capability resource type:\t%s\n", "Map Pool (PMDS)");
|
||||||
|
break;
|
||||||
|
case CAP_RTYPE_CPUPOOL:
|
||||||
|
printf("Capability resource type:\t%s\n", "Cpu Pool");
|
||||||
|
break;
|
||||||
|
case CAP_RTYPE_CAPPOOL:
|
||||||
|
printf("Capability resource type:\t%s\n", "Capability Pool");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("Capability resource type:\t%s\n", "Unknown");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void cap_array_print(int total_caps, struct capability *caparray)
|
||||||
|
{
|
||||||
|
printf("Capabilities\n"
|
||||||
|
"~~~~~~~~~~~~\n");
|
||||||
|
|
||||||
|
for (int i = 0; i < total_caps; i++)
|
||||||
|
cap_print(&caparray[i]);
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
@@ -17,7 +17,6 @@ void copy_boot_capabilities();
|
|||||||
|
|
||||||
int sys_request_cap(struct tcb *sender, struct capability *c);
|
int sys_request_cap(struct tcb *sender, struct capability *c);
|
||||||
|
|
||||||
void cap_print(struct capability *cap);
|
|
||||||
void cap_list_print(struct cap_list *cap_list);
|
void cap_list_print(struct cap_list *cap_list);
|
||||||
void setup_caps();
|
void setup_caps();
|
||||||
#endif /* __MM0_CAPABILITY_H__ */
|
#endif /* __MM0_CAPABILITY_H__ */
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <init.h>
|
#include <init.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <capability.h>
|
#include <capability.h>
|
||||||
#include <l4/api/capability.h>
|
#include <l4lib/capability/cap_print.h>
|
||||||
#include <l4/api/errno.h>
|
#include <l4/api/errno.h>
|
||||||
#include <l4/lib/list.h>
|
#include <l4/lib/list.h>
|
||||||
#include <l4lib/arch/syscalls.h>
|
#include <l4lib/arch/syscalls.h>
|
||||||
@@ -22,113 +22,6 @@ struct cap_list capability_list;
|
|||||||
__initdata static struct capability *caparray;
|
__initdata static struct capability *caparray;
|
||||||
__initdata static int total_caps = 0;
|
__initdata static int total_caps = 0;
|
||||||
|
|
||||||
|
|
||||||
void cap_dev_print(struct capability *cap)
|
|
||||||
{
|
|
||||||
switch (cap_devtype(cap)) {
|
|
||||||
case CAP_DEVTYPE_UART:
|
|
||||||
printf("Device type:\t\t\t%s%d\n", "UART", cap_devnum(cap));
|
|
||||||
break;
|
|
||||||
case CAP_DEVTYPE_TIMER:
|
|
||||||
printf("Device type:\t\t\t%s%d\n", "Timer", cap_devnum(cap));
|
|
||||||
break;
|
|
||||||
case CAP_DEVTYPE_CLCD:
|
|
||||||
printf("Device type:\t\t\t%s%d\n", "CLCD", cap_devnum(cap));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
printf("Device Irq:\t\t%d\n", cap->irq);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cap_print(struct capability *cap)
|
|
||||||
{
|
|
||||||
printf("Capability id:\t\t\t%d\n", cap->capid);
|
|
||||||
printf("Capability resource id:\t\t%d\n", cap->resid);
|
|
||||||
printf("Capability owner id:\t\t%d\n",cap->owner);
|
|
||||||
|
|
||||||
switch (cap_type(cap)) {
|
|
||||||
case CAP_TYPE_TCTRL:
|
|
||||||
printf("Capability type:\t\t%s\n", "Thread Control");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_EXREGS:
|
|
||||||
printf("Capability type:\t\t%s\n", "Exchange Registers");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_MAP_PHYSMEM:
|
|
||||||
if (!cap_is_devmem(cap)) {
|
|
||||||
printf("Capability type:\t\t%s\n", "Map/Physmem");
|
|
||||||
} else {
|
|
||||||
printf("Capability type:\t\t%s\n", "Map/Physmem/Device");
|
|
||||||
cap_dev_print(cap);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_MAP_VIRTMEM:
|
|
||||||
printf("Capability type:\t\t%s\n", "Map/Virtmem");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_IPC:
|
|
||||||
printf("Capability type:\t\t%s\n", "Ipc");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_UMUTEX:
|
|
||||||
printf("Capability type:\t\t%s\n", "Mutex");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_IRQCTRL:
|
|
||||||
printf("Capability type:\t\t%s\n", "IRQ Control");
|
|
||||||
break;
|
|
||||||
case CAP_TYPE_QUANTITY:
|
|
||||||
printf("Capability type:\t\t%s\n", "Quantitative");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("Capability type:\t\t%s\n", "Unknown");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (cap_rtype(cap)) {
|
|
||||||
case CAP_RTYPE_THREAD:
|
|
||||||
printf("Capability resource type:\t%s\n", "Thread");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_SPACE:
|
|
||||||
printf("Capability resource type:\t%s\n", "Space");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_CONTAINER:
|
|
||||||
printf("Capability resource type:\t%s\n", "Container");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_THREADPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Thread Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_SPACEPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Space Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_MUTEXPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Mutex Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_MAPPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Map Pool (PMDS)");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_CPUPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Cpu Pool");
|
|
||||||
break;
|
|
||||||
case CAP_RTYPE_CAPPOOL:
|
|
||||||
printf("Capability resource type:\t%s\n", "Capability Pool");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("Capability resource type:\t%s\n", "Unknown");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void cap_array_print()
|
|
||||||
{
|
|
||||||
printf("Capabilities\n"
|
|
||||||
"~~~~~~~~~~~~\n");
|
|
||||||
|
|
||||||
for (int i = 0; i < total_caps; i++)
|
|
||||||
cap_print(&caparray[i]);
|
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void cap_list_print(struct cap_list *cap_list)
|
void cap_list_print(struct cap_list *cap_list)
|
||||||
{
|
{
|
||||||
struct capability *cap;
|
struct capability *cap;
|
||||||
|
|||||||
@@ -6,9 +6,8 @@
|
|||||||
#ifndef __API_CAPABILITY_H__
|
#ifndef __API_CAPABILITY_H__
|
||||||
#define __API_CAPABILITY_H__
|
#define __API_CAPABILITY_H__
|
||||||
|
|
||||||
#if defined(__KERNEL__)
|
|
||||||
#include <l4/lib/list.h>
|
#include <l4/lib/list.h>
|
||||||
#endif
|
#include INC_ARCH(types.h)
|
||||||
|
|
||||||
/* Capability syscall request types */
|
/* Capability syscall request types */
|
||||||
#define CAP_CONTROL_NCAPS 0x00000000
|
#define CAP_CONTROL_NCAPS 0x00000000
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#ifndef __LIST_H__
|
#ifndef __LIST_H__
|
||||||
#define __LIST_H__
|
#define __LIST_H__
|
||||||
|
|
||||||
|
#include <l4/macros.h>
|
||||||
|
|
||||||
#define L4_DEADWORD 0xDEADCCCC
|
#define L4_DEADWORD 0xDEADCCCC
|
||||||
|
|
||||||
struct link {
|
struct link {
|
||||||
|
|||||||
Reference in New Issue
Block a user