aboutsummaryrefslogtreecommitdiff
path: root/arch/i686/macros.s
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2022-03-28 20:03:38 +0300
committeraqua <aqua@iserlohn-fortress.net>2022-08-12 10:13:59 +0300
commitedf9e71e2a7b6b89775c29cf28c19c6b89992c25 (patch)
tree3adbf944d9e47a743063487c4facb7eed1fbdee0 /arch/i686/macros.s
downloadkernel-edf9e71e2a7b6b89775c29cf28c19c6b89992c25.tar.xz
Initial commit
x86 kernel that prints a hello world message to com1
Diffstat (limited to 'arch/i686/macros.s')
-rw-r--r--arch/i686/macros.s25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/i686/macros.s b/arch/i686/macros.s
new file mode 100644
index 0000000..a9b8b4d
--- /dev/null
+++ b/arch/i686/macros.s
@@ -0,0 +1,25 @@
+.set PAGE_RO, 0x001
+.set PAGE_RW, 0x003
+/* write section to page table macro
+ *
+ * Registers used:
+ * %ecx: loop counter [ set to $1024 ]
+ * %edx: temporary
+ * %esi: current page being mapped
+ * %edi: page entry [ set to $page_addr ]
+ */
+.macro mmap_section begin, end, access
+ mov $\begin, %esi # from $begin
+1: cmpl $\end, %esi # until $end
+ jge 2f
+
+ movl %esi, %edx
+ orl $\access, %edx
+ movl %edx, (%edi)
+
+ addl $4096, %esi # move to next page
+ addl $4, %edi # size of page entry is 4 bytes
+ loop 1b # loop according to %ecx
+2:
+.endm
+