mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
A bunch of gem5 o3 example timelines. Not fully understood, but a good start.
This commit is contained in:
@@ -10,7 +10,7 @@ _start:
|
||||
asm_main_after_prologue:
|
||||
/* Skip these two instructions to align with the cache line.
|
||||
* Now that's some proper microbenchmarking!
|
||||
* https://cirosantilli.com/linux-kernel-module-cheat#gem5-event-queue-minorcpu-syscall-emulation-freestanding-example-analysis-hazardless */
|
||||
* https://cirosantilli.com/linux-kernel-module-cheat#gem5-event-queue-derivo3cpu-syscall-emulation-freestanding-example-analysis-hazardless */
|
||||
mov x0, 0
|
||||
mov x1, 1
|
||||
|
||||
@@ -22,7 +22,6 @@ asm_main_after_prologue:
|
||||
mov x7, 7
|
||||
mov x8, 8
|
||||
mov x9, 9
|
||||
|
||||
mov x10, 10
|
||||
mov x11, 11
|
||||
mov x12, 12
|
||||
@@ -31,7 +30,6 @@ asm_main_after_prologue:
|
||||
mov x15, 15
|
||||
mov x16, 16
|
||||
mov x17, 17
|
||||
|
||||
mov x18, 18
|
||||
mov x19, 19
|
||||
mov x20, 20
|
||||
|
||||
38
userland/arch/aarch64/freestanding/linux/hazard4.S
Normal file
38
userland/arch/aarch64/freestanding/linux/hazard4.S
Normal file
@@ -0,0 +1,38 @@
|
||||
/* https://cirosantilli.com/linux-kernel-module-cheat#gem5-event-queue-derivo3cpu-syscall-emulation-freestanding-example-analysis-hazard4 */
|
||||
|
||||
.text
|
||||
.global _start
|
||||
_start:
|
||||
asm_main_after_prologue:
|
||||
mov x0, 0
|
||||
mov x1, 1
|
||||
|
||||
mov x2, 2
|
||||
add x3, x2, 1
|
||||
add x4, x3, 1
|
||||
add x5, x4, 1
|
||||
add x6, x5, 1
|
||||
mov x7, 7
|
||||
mov x8, 8
|
||||
mov x9, 9
|
||||
mov x10, 10
|
||||
mov x11, 11
|
||||
mov x12, 12
|
||||
mov x13, 13
|
||||
mov x14, 14
|
||||
mov x15, 15
|
||||
mov x16, 16
|
||||
mov x17, 17
|
||||
mov x18, 18
|
||||
mov x19, 19
|
||||
mov x20, 20
|
||||
mov x21, 21
|
||||
mov x22, 22
|
||||
mov x23, 23
|
||||
mov x24, 24
|
||||
mov x25, 25
|
||||
|
||||
/* exit */
|
||||
mov x0, 0
|
||||
mov x8, 93
|
||||
svc 0
|
||||
42
userland/arch/aarch64/freestanding/linux/speculative.S
Normal file
42
userland/arch/aarch64/freestanding/linux/speculative.S
Normal file
@@ -0,0 +1,42 @@
|
||||
/* An example that does not have any CPU pipeline hazards, to observe
|
||||
* the simpliest possible steady state of CPU execution.
|
||||
* Useful during microarchitectural analysis such as:
|
||||
* https://cirosantilli.com/linux-kernel-module-cheat#gem5-event-queue-minorcpu-syscall-emulation-freestanding-example-analysis
|
||||
*/
|
||||
|
||||
.text
|
||||
.global _start
|
||||
_start:
|
||||
asm_main_after_prologue:
|
||||
|
||||
/* ifetch 1 */
|
||||
/* argc */
|
||||
ldr x0, [sp]
|
||||
mov x1, 1
|
||||
|
||||
/* ifetch 2 */
|
||||
.Lifetch2:
|
||||
mov x2, 2
|
||||
mov x3, 3
|
||||
mov x4, 4
|
||||
mov x5, 5
|
||||
mov x6, 6
|
||||
/* Check if a CLi argument was passed. */
|
||||
cmp x0, 2
|
||||
/* Ensure that we will break out on the next loop. */
|
||||
mov x0, 3
|
||||
blt .Lifetch2
|
||||
|
||||
mov x10, 10
|
||||
mov x11, 11
|
||||
mov x12, 12
|
||||
mov x13, 13
|
||||
mov x14, 14
|
||||
mov x15, 15
|
||||
mov x16, 16
|
||||
mov x17, 17
|
||||
|
||||
/* exit */
|
||||
mov x0, 0
|
||||
mov x8, 93
|
||||
svc 0
|
||||
74
userland/arch/aarch64/freestanding/linux/stall-gain.S
Normal file
74
userland/arch/aarch64/freestanding/linux/stall-gain.S
Normal file
@@ -0,0 +1,74 @@
|
||||
/* https://cirosantilli.com/linux-kernel-module-cheat#gem5-event-queue-derivo3cpu-syscall-emulation-freestanding-example-analysis-stall-gain */
|
||||
|
||||
.text
|
||||
.global _start
|
||||
_start:
|
||||
asm_main_after_prologue:
|
||||
mov x0, 0
|
||||
mov x1, 1
|
||||
mov x2, 4
|
||||
mov x3, 5
|
||||
adr x4, mydata
|
||||
ldr x5, [x4]
|
||||
mov x6, 6
|
||||
mov x7, 7
|
||||
mov x8, 8
|
||||
mov x9, 9
|
||||
mov x10, 10
|
||||
mov x11, 11
|
||||
mov x12, 12
|
||||
mov x13, 13
|
||||
mov x14, 14
|
||||
mov x15, 15
|
||||
mov x16, 16
|
||||
mov x17, 17
|
||||
mov x18, 18
|
||||
mov x19, 19
|
||||
mov x20, 20
|
||||
mov x21, 21
|
||||
mov x22, 22
|
||||
mov x23, 23
|
||||
mov x24, 24
|
||||
mov x25, 25
|
||||
mov x26, 26
|
||||
mov x27, 27
|
||||
mov x28, 28
|
||||
mov x29, 29
|
||||
|
||||
mov x0, 0
|
||||
mov x1, 1
|
||||
mov x2, 2
|
||||
mov x3, 3
|
||||
mov x4, 4
|
||||
mov x5, 5
|
||||
mov x6, 6
|
||||
mov x7, 7
|
||||
mov x8, 8
|
||||
mov x9, 9
|
||||
mov x10, 10
|
||||
mov x11, 11
|
||||
mov x12, 12
|
||||
mov x13, 13
|
||||
mov x14, 14
|
||||
mov x15, 15
|
||||
mov x16, 16
|
||||
mov x17, 17
|
||||
mov x18, 18
|
||||
mov x19, 19
|
||||
mov x20, 20
|
||||
mov x21, 21
|
||||
mov x22, 22
|
||||
mov x23, 23
|
||||
mov x24, 24
|
||||
mov x25, 25
|
||||
mov x26, 26
|
||||
mov x27, 27
|
||||
mov x28, 28
|
||||
mov x29, 29
|
||||
|
||||
/* exit */
|
||||
mov x0, 0
|
||||
mov x8, 93
|
||||
svc 0
|
||||
.data
|
||||
mydata: .skip 16
|
||||
74
userland/arch/aarch64/freestanding/linux/stall-hazard4.S
Normal file
74
userland/arch/aarch64/freestanding/linux/stall-hazard4.S
Normal file
@@ -0,0 +1,74 @@
|
||||
/* https://cirosantilli.com/linux-kernel-module-cheat#gem5-event-queue-derivo3cpu-syscall-emulation-freestanding-example-analysis-stall-hazard4 */
|
||||
|
||||
.text
|
||||
.global _start
|
||||
_start:
|
||||
asm_main_after_prologue:
|
||||
mov x0, 0
|
||||
mov x1, 1
|
||||
mov x2, 4
|
||||
mov x3, 5
|
||||
adr x4, mydata
|
||||
ldr x5, [x4]
|
||||
add x6, x5, 1
|
||||
add x7, x6, 1
|
||||
add x8, x7, 1
|
||||
add x9, x8, 1
|
||||
mov x10, 10
|
||||
mov x11, 11
|
||||
mov x12, 12
|
||||
mov x13, 13
|
||||
mov x14, 14
|
||||
mov x15, 15
|
||||
mov x16, 16
|
||||
mov x17, 17
|
||||
mov x18, 18
|
||||
mov x19, 19
|
||||
mov x20, 20
|
||||
mov x21, 21
|
||||
mov x22, 22
|
||||
mov x23, 23
|
||||
mov x24, 24
|
||||
mov x25, 25
|
||||
mov x26, 26
|
||||
mov x27, 27
|
||||
mov x28, 28
|
||||
mov x29, 29
|
||||
|
||||
mov x0, 0
|
||||
mov x1, 1
|
||||
mov x2, 2
|
||||
mov x3, 3
|
||||
mov x4, 4
|
||||
mov x5, 5
|
||||
mov x6, 6
|
||||
mov x7, 7
|
||||
mov x8, 8
|
||||
mov x9, 9
|
||||
mov x10, 10
|
||||
mov x11, 11
|
||||
mov x12, 12
|
||||
mov x13, 13
|
||||
mov x14, 14
|
||||
mov x15, 15
|
||||
mov x16, 16
|
||||
mov x17, 17
|
||||
mov x18, 18
|
||||
mov x19, 19
|
||||
mov x20, 20
|
||||
mov x21, 21
|
||||
mov x22, 22
|
||||
mov x23, 23
|
||||
mov x24, 24
|
||||
mov x25, 25
|
||||
mov x26, 26
|
||||
mov x27, 27
|
||||
mov x28, 28
|
||||
mov x29, 29
|
||||
|
||||
/* exit */
|
||||
mov x0, 0
|
||||
mov x8, 93
|
||||
svc 0
|
||||
.data
|
||||
mydata: .skip 16
|
||||
74
userland/arch/aarch64/freestanding/linux/stall.S
Normal file
74
userland/arch/aarch64/freestanding/linux/stall.S
Normal file
@@ -0,0 +1,74 @@
|
||||
/* https://cirosantilli.com/linux-kernel-module-cheat#gem5-event-queue-derivo3cpu-syscall-emulation-freestanding-example-analysis-stall */
|
||||
|
||||
.text
|
||||
.global _start
|
||||
_start:
|
||||
asm_main_after_prologue:
|
||||
mov x0, 0
|
||||
mov x1, 1
|
||||
adr x2, mydata
|
||||
ldr x3, [x2]
|
||||
mov x4, 4
|
||||
mov x5, 5
|
||||
mov x6, 6
|
||||
mov x7, 7
|
||||
mov x8, 8
|
||||
mov x9, 9
|
||||
mov x10, 10
|
||||
mov x11, 11
|
||||
mov x12, 12
|
||||
mov x13, 13
|
||||
mov x14, 14
|
||||
mov x15, 15
|
||||
mov x16, 16
|
||||
mov x17, 17
|
||||
mov x18, 18
|
||||
mov x19, 19
|
||||
mov x20, 20
|
||||
mov x21, 21
|
||||
mov x22, 22
|
||||
mov x23, 23
|
||||
mov x24, 24
|
||||
mov x25, 25
|
||||
mov x26, 26
|
||||
mov x27, 27
|
||||
mov x28, 28
|
||||
mov x29, 29
|
||||
|
||||
mov x0, 0
|
||||
mov x1, 1
|
||||
mov x2, 2
|
||||
mov x3, 3
|
||||
mov x4, 4
|
||||
mov x5, 5
|
||||
mov x6, 6
|
||||
mov x7, 7
|
||||
mov x8, 8
|
||||
mov x9, 9
|
||||
mov x10, 10
|
||||
mov x11, 11
|
||||
mov x12, 12
|
||||
mov x13, 13
|
||||
mov x14, 14
|
||||
mov x15, 15
|
||||
mov x16, 16
|
||||
mov x17, 17
|
||||
mov x18, 18
|
||||
mov x19, 19
|
||||
mov x20, 20
|
||||
mov x21, 21
|
||||
mov x22, 22
|
||||
mov x23, 23
|
||||
mov x24, 24
|
||||
mov x25, 25
|
||||
mov x26, 26
|
||||
mov x27, 27
|
||||
mov x28, 28
|
||||
mov x29, 29
|
||||
|
||||
/* exit */
|
||||
mov x0, 0
|
||||
mov x8, 93
|
||||
svc 0
|
||||
.data
|
||||
mydata: .skip 16
|
||||
Reference in New Issue
Block a user