9. The total length of all curve segments formed by a moving point on the surface of a regular quadrilateral pyramid $P-ABCD$ with lateral edge length and base edge length both being 4, and at a distance of 3 from the vertex $P$, is

保留源文本的换行和格式，直接输出翻译结果如下：

9. The total length of all curve segments formed by a moving point on the surface of a regular quadrilateral pyramid $P-ABCD$ with lateral edge length and base edge length both being 4, and at a distance of 3 from the vertex $P$, is
9. $6 \pi$.

On the side faces of a regular quadrilateral pyramid, the moving point forms four arcs with a radius of 3 and a central angle of $\frac{\pi}{3}$, the sum of whose lengths is
$$
l_{1}=4 \times \frac{\pi}{3} \times 3=4 \pi \text {. }
$$

It is also known that the height of the regular quadrilateral pyramid is
$$
h=\sqrt{4^{2}-(2 \sqrt{2})^{2}}=2 \sqrt{2}<3 \text {, }
$$

then the moving point on the base forms a circle with a radius of
$$
r=\sqrt{3^{2}-(2 \sqrt{2})^{2}}=1
$$

whose circumference is $l_{2}=2 \pi$.
Therefore, the total length of all the curve segments formed by the moving point on the surface of the regular quadrilateral pyramid is $l_{1}+l_{2}=6 \pi$.