[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Use portable rpc types to define 'struct sample'.
From: |
Samuel Thibault |
Subject: |
Re: [PATCH] Use portable rpc types to define 'struct sample'. |
Date: |
Mon, 28 Nov 2022 02:41:46 +0100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Applied, thanks!
Flavio Cruz, le dim. 27 nov. 2022 20:34:14 -0500, a ecrit:
> ---
> include/mach/mach4.defs | 10 ++++++++--
> include/mach/pc_sample.h | 6 +++---
> kern/pc_sample.c | 4 ++--
> 3 files changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/include/mach/mach4.defs b/include/mach/mach4.defs
> index 61423a44..53cca7d3 100644
> --- a/include/mach/mach4.defs
> +++ b/include/mach/mach4.defs
> @@ -41,10 +41,16 @@ subsystem
>
>
> #ifdef MACH_PCSAMPLE
> -type sampled_pc_t = struct[3] of natural_t;
> +type sampled_pc_flavor_t = unsigned;
> +
> +type sampled_pc_t = struct {
> + rpc_vm_offset_t id;
> + rpc_vm_offset_t pc;
> + sampled_pc_flavor_t sampletype;
> +};
> +
> type sampled_pc_array_t = array[*:512] of sampled_pc_t;
> type sampled_pc_seqno_t = unsigned;
> -type sampled_pc_flavor_t = natural_t;
>
> routine task_enable_pc_sampling(
> host : task_t;
> diff --git a/include/mach/pc_sample.h b/include/mach/pc_sample.h
> index 662addb9..b76ccfcd 100644
> --- a/include/mach/pc_sample.h
> +++ b/include/mach/pc_sample.h
> @@ -29,7 +29,7 @@
>
> #include <mach/machine/vm_types.h>
>
> -typedef natural_t sampled_pc_flavor_t;
> +typedef unsigned int sampled_pc_flavor_t;
>
>
> #define SAMPLED_PC_PERIODIC 0x1 /* default */
> @@ -54,8 +54,8 @@ typedef natural_t sampled_pc_flavor_t;
> */
>
> typedef struct sampled_pc {
> - natural_t id;
> - vm_offset_t pc;
> + rpc_vm_offset_t id; /* task_t address */
> + rpc_vm_offset_t pc; /* program counter */
> sampled_pc_flavor_t sampletype;
> } sampled_pc_t;
>
> diff --git a/kern/pc_sample.c b/kern/pc_sample.c
> index e9f0b16a..6c891fe1 100644
> --- a/kern/pc_sample.c
> +++ b/kern/pc_sample.c
> @@ -60,8 +60,8 @@ void take_pc_sample(
>
> cp->seqno++;
> sample = &((sampled_pc_t *)cp->buffer)[cp->seqno % MAX_PC_SAMPLES];
> - sample->id = (vm_offset_t)t;
> - sample->pc = pc;
> + sample->id = (rpc_vm_offset_t)t;
> + sample->pc = (rpc_vm_offset_t)pc;
> sample->sampletype = flavor;
> }
>
> --
> 2.37.2
>
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.