It depends on the target platform and the starting platform, dependencies and others.
If you're "lucky", you'll need to re-write only rendering, input and (optional) audio system code.
If you're "not so lucky", you'll have to modify also CPU related code (ASM calls for examples) and everything that could cause issues related to the hardware (for example, enums dimension, vars definition (on ARM architecture, chars are unsigned, on MIPS architecture, they're signed for example), GPU directives...).
If you're "unlucky", you'll also need to optimize code to make it run on the target platform at a decent framerate (looks for example to DaedalusX64 emulator for PSP).
There are also a lot of source ports which are using libraries currently not available (or not completely available) on 3DS (openGL, SDL, SDL2 for example). In that cases, you'll also have to write a proper wrapper for these libraries.