Skip to content

Commit

Permalink
Merge branch 'master' of github.com:fxlin/p1-kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
fxlin committed Feb 29, 2024
2 parents 2a3e599 + 913b72f commit 29a4228
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions docs/exp6/rpi-os.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ Notable points:

* MMU starts memory translation process by locating the base address of PGD. MMU locates the base address from the `TTBRx_EL1` register which should be set by the kernel. TTBR = translation table base register.

* bits [63-47] = 0xffff (all 1s). MMU uses `ttbr1_el1`. This is meant for the kernel space.
* bits [63-47] = 0x0 (all 1s). MMU uses `ttbr0_el1`. This is meant for the user process.
* bits [63-48] = 0xffff (all 1s). MMU uses `ttbr1_el1`. This is meant for the kernel space.
* bits [63-48] = 0x0 (all 0s). MMU uses `ttbr0_el1`. This is meant for the user process.
* Each process has its own address space. Therefore, it has its own copy of page table tree, starting from PGD. Therefore, the kernel keeps a separate PGD base address for each process. That is, the kernel virtualizes PGD for processes. During a context switch, the kernel loads the PGD base of the next process to `ttbr0_el1`.

* MMU walks the pgtable tree to look up the physical address. A virtual address uses only 48 out of 64 available bits. When doing a translation, MMU splits an address into 4 parts:
Expand Down Expand Up @@ -823,7 +823,7 @@ All other details of the forking procedure work exactly in the same way, as they

> Q: does our fork() implement COW?
<!--- ### Allocating new pages on demand --->
<!--- ### Nope... it copies over all pages & contents. --->

## Demand paging

Expand Down
10 changes: 9 additions & 1 deletion docs/gdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ print (short[10])*mem_map
```
b *0xffff0000
```
### Disassemble at given addr

```
disas 0xffff0000
```
### Function/source lookup

Look up type of a given symbol
Expand All @@ -142,7 +146,11 @@ List source at a given addr
list *0x10000000
list *fn
```

### Watchpoint
Will break if the given memory addr is altered
```
watch *0xffff0000
```
## The GDB "dashboard" enhancement

The basic GDB UI is too primitive to beginners. We provide you an enhancement called GDB-dashboard. The upstream source is [here](https://github.com/fxlin/gdb-dashboard-aarch64). I adapted it for aarch64. Screenshot:
Expand Down

0 comments on commit 29a4228

Please sign in to comment.