--- Gnu-Mach/kern/pc_sample.c 2020/09/02 04:36:57 1.1 +++ Gnu-Mach/kern/pc_sample.c 2020/09/02 04:45:16 1.1.1.2 @@ -24,16 +24,18 @@ * the rights to redistribute these changes. */ - - -#include +#include +#include #include /* vm_address_t */ #include /* pointer_t */ #include +#include +#include #include #include #include +#include #if MACH_PCSAMPLE @@ -55,7 +57,7 @@ void take_pc_sample( pc = interrupted_pc(t); cp->seqno++; sample = &((sampled_pc_t *)cp->buffer)[cp->seqno % MAX_PC_SAMPLES]; - sample->id = (natural_t)t; + sample->id = (vm_offset_t)t; sample->pc = pc; sample->sampletype = flavor; } @@ -67,7 +69,6 @@ thread_enable_pc_sampling( sampled_pc_flavor_t flavors) { vm_offset_t buf; - extern int tick; if (thread == THREAD_NULL) { return KERN_INVALID_ARGUMENT; @@ -93,7 +94,6 @@ task_enable_pc_sampling( sampled_pc_flavor_t flavors) { vm_offset_t buf; - extern int tick; if (task == TASK_NULL) { return KERN_INVALID_ARGUMENT; @@ -178,19 +178,19 @@ get_sampled_pcs( * Simple case: no wraparound. * Copy from seqidx1 to seqidx2. */ - bcopy((sampled_pc_array_t)cp->buffer + seqidx1 + 1, - sampled_pcs_out, - nsamples * sizeof(sampled_pc_t)); + memcpy(sampled_pcs_out, + (sampled_pc_array_t)cp->buffer + seqidx1 + 1, + nsamples * sizeof(sampled_pc_t)); } else { /* seqidx1 > seqidx2 -- Handle wraparound. */ - bcopy((sampled_pc_array_t)cp->buffer + seqidx1 + 1, - sampled_pcs_out, - (MAX_PC_SAMPLES - seqidx1 - 1) * sizeof(sampled_pc_t)); - - bcopy((sampled_pc_array_t)cp->buffer, - sampled_pcs_out + (MAX_PC_SAMPLES - seqidx1 - 1), - (seqidx2 + 1) * sizeof(sampled_pc_t)); + memcpy(sampled_pcs_out, + (sampled_pc_array_t)cp->buffer + seqidx1 + 1, + (MAX_PC_SAMPLES - seqidx1 - 1) * sizeof(sampled_pc_t)); + + memcpy(sampled_pcs_out + (MAX_PC_SAMPLES - seqidx1 - 1), + (sampled_pc_array_t)cp->buffer, + (seqidx2 + 1) * sizeof(sampled_pc_t)); } } else { /* could either be zero because of overflow, or because