mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 20:05:54 +00:00
base-hw: store Platform_pd pointer in Kernel::Pd
This enables the kernel to print out the label of the program a thread belongs to. fix #662
This commit is contained in:
parent
f3ef943bd8
commit
4b224dd67e
@ -20,6 +20,7 @@
|
||||
namespace Genode
|
||||
{
|
||||
class Platform_thread;
|
||||
class Platform_pd;
|
||||
class Tlb;
|
||||
}
|
||||
|
||||
@ -29,6 +30,7 @@ namespace Kernel
|
||||
typedef Genode::addr_t addr_t;
|
||||
typedef Genode::size_t size_t;
|
||||
typedef Genode::Platform_thread Platform_thread;
|
||||
typedef Genode::Platform_pd Platform_pd;
|
||||
|
||||
/**
|
||||
* Unique opcodes of all syscalls supported by the kernel
|
||||
@ -143,6 +145,7 @@ namespace Kernel
|
||||
*
|
||||
* \param dst physical base of an appropriate portion of memory
|
||||
* that is thereupon allocated to the kernel
|
||||
* \param pd core local Platform_pd object
|
||||
*
|
||||
* \retval >0 ID of the new PD
|
||||
* \retval 0 if no new PD was created
|
||||
@ -150,8 +153,8 @@ namespace Kernel
|
||||
* Restricted to core threads. Regaining of the supplied memory is not
|
||||
* supported by now.
|
||||
*/
|
||||
inline int new_pd(void * const dst) {
|
||||
return syscall(NEW_PD, (Syscall_arg)dst); }
|
||||
inline int new_pd(void * const dst, Platform_pd * const pd) {
|
||||
return syscall(NEW_PD, (Syscall_arg)dst, (Syscall_arg)pd); }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -37,11 +37,11 @@ namespace Genode
|
||||
*/
|
||||
class Platform_pd : public Address_space
|
||||
{
|
||||
unsigned _id; /* ID of our kernel object */
|
||||
Native_capability _parent; /* our parent interface */
|
||||
Native_thread_id _main_thread; /* the first thread that gets
|
||||
* executed in this PD */
|
||||
char const * _label; /* PD-connection label */
|
||||
unsigned _id; /* ID of our kernel object */
|
||||
Native_capability _parent; /* our parent interface */
|
||||
Native_thread_id _main_thread; /* the first thread that gets
|
||||
* executed in this PD */
|
||||
char const * const _label; /* PD-connection label */
|
||||
|
||||
public:
|
||||
|
||||
@ -57,7 +57,7 @@ namespace Genode
|
||||
Kernel::pd_alignm_log2()).is_ok())
|
||||
|
||||
/* create kernel object */
|
||||
_id = Kernel::new_pd(kernel_pd);
|
||||
_id = Kernel::new_pd(kernel_pd, this);
|
||||
assert(_id);
|
||||
}
|
||||
|
||||
@ -102,6 +102,13 @@ namespace Genode
|
||||
}
|
||||
|
||||
|
||||
/***************
|
||||
** Accessors **
|
||||
***************/
|
||||
|
||||
char const * const label() { return _label; }
|
||||
|
||||
|
||||
/*****************************
|
||||
** Address-space interface **
|
||||
*****************************/
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
/* core includes */
|
||||
#include <platform_thread.h>
|
||||
#include <platform_pd.h>
|
||||
#include <tlb.h>
|
||||
#include <trustzone.h>
|
||||
|
||||
@ -268,7 +269,8 @@ namespace Kernel
|
||||
*/
|
||||
class Pd : public Object<Pd, MAX_PDS>
|
||||
{
|
||||
Tlb * const _tlb;
|
||||
Tlb * const _tlb;
|
||||
Platform_pd * const _platform_pd;
|
||||
|
||||
/* keep ready memory for size aligned extra costs at construction */
|
||||
enum { EXTRA_SPACE_SIZE = 2*Tlb::MAX_COSTS_PER_TRANSLATION };
|
||||
@ -279,7 +281,8 @@ namespace Kernel
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Pd(Tlb * const t) : _tlb(t)
|
||||
Pd(Tlb * const t, Platform_pd * const platform_pd)
|
||||
: _tlb(t), _platform_pd(platform_pd)
|
||||
{
|
||||
/* try to add translation for mode transition region */
|
||||
Page_flags::access_t const flags = Page_flags::mode_transition();
|
||||
@ -322,7 +325,8 @@ namespace Kernel
|
||||
** Accessors **
|
||||
***************/
|
||||
|
||||
Tlb * tlb() { return _tlb; }
|
||||
Tlb * const tlb() { return _tlb; }
|
||||
Platform_pd * const platform_pd() { return _platform_pd; }
|
||||
};
|
||||
|
||||
|
||||
@ -404,7 +408,7 @@ namespace Kernel
|
||||
static Pd * core()
|
||||
{
|
||||
static Core_tlb tlb;
|
||||
static Pd _pd(&tlb);
|
||||
static Pd _pd(&tlb, 0);
|
||||
return &_pd;
|
||||
}
|
||||
|
||||
@ -833,7 +837,7 @@ namespace Kernel
|
||||
void * dst = (void *)user->user_arg_1();
|
||||
Tlb * const tlb = new (dst) Tlb();
|
||||
dst = (void *)((addr_t)dst + sizeof(Tlb));
|
||||
Pd * const pd = new (dst) Pd(tlb);
|
||||
Pd * const pd = new (dst) Pd(tlb, (Platform_pd *)user->user_arg_2());
|
||||
|
||||
/* return success */
|
||||
user->user_arg_0(pd->id());
|
||||
|
Loading…
x
Reference in New Issue
Block a user