我假设你有一个 x86 的操作系统。在这种情况下,您至少需要几页汇编程序来设置保护模式和类似的东西,除此之外,还有很多关于分页、调用门、响铃、异常等所有东西的知识。如果你要使用一种系统调用形式,您还需要几行汇编代码来在内核模式和用户空间模式之间切换。
除了这些之外,操作系统的其余部分可以很容易地用 C 编程。对于 C++,你需要一个运行时环境来支持虚拟成员和异常之类的东西,但据我所知,它们都可以用 C 编程。
Just take a look at Linux kernel source, the most important assembler code (for x86) can be found in arch/x86/boot, but you'll notice that even in that directory most files are written in C. Furthermore you'll find a few assembly lines in the arch/x86/kernel directory for handling system calls and stuff like that.
Outside the arch directory there is hardly any assembler used (because assembler is machine specific, that machine specific code belongs in the arch directory). Even graphic drivers don't use assembler (e.g. nvidia driver in drivers/gpu/drm/nouveau).