Link Search Menu Expand Document

Assembly

Just like when using GPRs, you must use assembly code to interact with the FPU. We recommend you read through floating-point control instructions (table 3-18) that you can perform on an FPU.

As mentioned before, you will not be working with the individual FPU registers but rather the entire FPU save state as a whole. Therefore, if you find yourself trying to work with each st register individually, take a step back and reread through the aforementioned floating-point control instructions.

When you are writing assembly, you may either do so directly in .S files or in-line among C code using asm. Most likely, you will have to do both. We recommend you read through a guide on asm to familiarize yourself. You may also find it helpful to reference some other parts of the code that use asm (e.g. start_process in userprog/process.c). Using asm can seem daunting, but keep in mind, at its core, it’s just writing assembly instructions instead of C!