Compare commits

...

2 Commits

Author SHA1 Message Date
9d077d1f3b
Document functions 2023-03-29 09:47:55 -05:00
4e8d025345
Fix PMM function names - they handle physical frames, not virtual pages 2023-03-29 09:47:37 -05:00
3 changed files with 23 additions and 14 deletions

View File

@ -4,13 +4,13 @@ main:
jsr term_init
jsr pmem_init
move.l #0x1000, d0
jsr push_page
jsr push_frame
move.l #0x2000, d0
jsr push_page
jsr push_frame
move.l #0, d0
jsr pop_page
jsr pop_page
jsr pop_page
jsr pop_frame
jsr pop_frame
jsr pop_frame
stop #0x2700
.bss

View File

@ -1,21 +1,25 @@
.text
.global pmem_init
| Initialize the physical memory manager
| Clobbers d0 and a0
pmem_init:
move.b #0x5, d0 | Get the pointer to the MMU card
jsr find_first_card
adda.l #0x10, a0
move.l a0, mmu_tlb_clear_addr
move.l #((map_page - 0xC00000)), d1 | Get the entry offset for the mapping page in d1
lsr.l #8, d1
lsr.l #2, d1
move.l #((map_page - 0xC00000)), d0 | Get the entry offset for the mapping page in d0
lsr.l #8, d0
lsr.l #2, d0
move.l #kernel_map_page, a0 | Get the address of the mapping entry for the mapping page in a0
adda.l d1, a0
adda.l d0, a0
move.l a0, map_page_entry_addr
rts
.global push_page
| Page to push in d0
push_page:
.global push_frame
| Pushes a frame onto the stack
| Frame to push in d0
| Clobbers d0, d1, and a0
push_frame:
move.l map_page_entry_addr, a0
move.l (a0), d1 | Read the mapping entry into d1
andi.l #(~0xFFF), d1 | Clear the entry's flags to get the pointer to it's physical page
@ -26,8 +30,11 @@ move.l #map_page, (a0)
move.l d1, (map_page)
rts
.global pop_page
pop_page:
.global pop_frame
| Pops a frame off the stack
| Returns frame address in d0
| Clobbers d1 and a0
pop_frame:
move.l map_page_entry_addr, a0
move.l (a0), d0 | Read the mapping entry into d0
btst #0, d0 | Check the entry's present flag

View File

@ -1,4 +1,6 @@
.global term_init
| Initializes the terminal card driver
| Clobbers d0, d1, and a0
term_init:
move.b #0x3, d0 | Get the pointer to the terminal card
jsr find_first_card