Skip to content

Commit

Permalink
Minor syntax fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamos82 committed Jan 1, 2024
1 parent f8cfce1 commit 9ec8cf3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 06_Userspace/04_System_Calls.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ We've probably heard of `int 0x80` before. That's the interrupt vector used by L

### Using Software Interrupts

Now we've selected which interrupt vector to use for system calls, we can install an interrupt handler. On `x86`, this is done via the IDT like any other interrupt handler. The only different is the DPL field.
Now we've selected which interrupt vector to use for system calls, we can install an interrupt handler. On `x86_64`, this is done via the IDT like any other interrupt handler. The only difference is the DPL field.

As mentioned before, the DPL field is the highest ring that is allowed to call this interrupt from software. By default it was left as 0, meaning only ring 0 can trigger software interrupts. Other rings trying to do this will trigger a general protection fault. However since we want ring 3 code to call this vector, we'll need to set its DPL to 3.

Expand Down
4 changes: 2 additions & 2 deletions 99_Appendices/C_Language_Info.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ asm("assembly_template"
```

* Every line of assembly code should terminate with: **;**
* Clobbered registers can usually be left empty. However if we use an instruction like `rdmsr` which places data in registers without the compiler knowing, we'll want to mark those are clobbered. If we specify eax/edx as output operands, the compiler is smart enough to work this out.
* Clobbered registers can usually be left empty. However if we use an instruction like `rdmsr` which places data in registers without the compiler knowing, we'll want to mark those as clobbered. If we specify eax/edx as output operands, the compiler is smart enough to work this out.
* One special clobber exists: "memory". This is a read/write barrier. It tells the compiler we've accessed memory other than what was specified as input/ouput operands. The cause of many optimization issues!
* For every operand type there can be more than one, in this case they must be comma separated.
* Every operand consists of a constraint and c expression pair. A constrait can also have a modifier itself
* Every operand consists of a constraint and `c` expression pair. A constrait can also have a modifier itself
* Operands parameters are indicated with an increasing number prefixed by a %, so the first operand declared is %0, the second is %1, etc. And the order they appears in the output/input operands section represent their numbering

Below is the list of the constraint modifiers:
Expand Down

0 comments on commit 9ec8cf3

Please sign in to comment.