mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
add more gdb tests
This commit is contained in:
@@ -4,8 +4,11 @@
|
||||
main:
|
||||
/* 1.5 + 2.5 == 4.0 */
|
||||
fmov d0, #1.5
|
||||
/* test-gdb-d0 */
|
||||
fmov d1, #2.5
|
||||
/* test-gdb-d1 */
|
||||
fadd d2, d0, d1
|
||||
/* test-gdb-d2 */
|
||||
fmov d3, #4.0
|
||||
fcmp d2, d3
|
||||
beq 1f
|
||||
@@ -14,7 +17,11 @@ main:
|
||||
|
||||
/* Now in 32-bit. */
|
||||
fmov s0, #1.5
|
||||
/* test-gdb-s0 */
|
||||
fmov s1, #2.5
|
||||
/* test-gdb-s1 */
|
||||
fadd s2, s0, s1
|
||||
/* test-gdb-s2 */
|
||||
fadd s2, s0, s1
|
||||
fmov s3, #4.0
|
||||
fcmp s2, s3
|
||||
@@ -22,4 +29,17 @@ main:
|
||||
bl assert_fail
|
||||
1:
|
||||
|
||||
/* Higher registers. */
|
||||
fmov d28, #1.5
|
||||
/* test-gdb-d28 */
|
||||
fmov d29, #2.5
|
||||
/* test-gdb-d29 */
|
||||
fadd d30, d28, d29
|
||||
/* test-gdb-d30 */
|
||||
fmov d31, #4.0
|
||||
/* test-gdb-d31 */
|
||||
fcmp d30, d31
|
||||
beq 1f
|
||||
bl assert_fail
|
||||
1:
|
||||
ret
|
||||
30
baremetal/arch/aarch64/fadd.py
Normal file
30
baremetal/arch/aarch64/fadd.py
Normal file
@@ -0,0 +1,30 @@
|
||||
def test(self):
|
||||
self.sendline('tbreak main')
|
||||
self.sendline('continue')
|
||||
|
||||
# Double.
|
||||
self.continue_to('d0')
|
||||
assert self.get_float('$d0') == 1.5
|
||||
self.continue_to('d1')
|
||||
assert self.get_float('$d1') == 2.5
|
||||
self.continue_to('d2')
|
||||
assert self.get_float('$d2') == 4.0
|
||||
|
||||
# Single.
|
||||
self.continue_to('s0')
|
||||
assert self.get_float('$s0') == 1.5
|
||||
self.continue_to('s1')
|
||||
assert self.get_float('$s1') == 2.5
|
||||
self.continue_to('s2')
|
||||
assert self.get_float('$s2') == 4.0
|
||||
|
||||
# High registers..
|
||||
self.continue_to('d28')
|
||||
assert self.get_float('$d28') == 1.5
|
||||
self.continue_to('d29')
|
||||
assert self.get_float('$d29') == 2.5
|
||||
self.continue_to('d30')
|
||||
assert self.get_float('$d30') == 4.0
|
||||
self.continue_to('d31')
|
||||
assert self.get_float('$d31') == 4.0
|
||||
|
||||
19
baremetal/arch/aarch64/regs.S
Normal file
19
baremetal/arch/aarch64/regs.S
Normal file
@@ -0,0 +1,19 @@
|
||||
/* Test that we can move:
|
||||
* - set registers
|
||||
* - read x30 */
|
||||
.global main
|
||||
main:
|
||||
/* test-gdb-before-x29 */
|
||||
mov x0, #1
|
||||
/* test-gdb-x0 */
|
||||
mov x1, #2
|
||||
/* test-gdb-x1 */
|
||||
|
||||
mov x29, #1
|
||||
/* test-gdb-x29 */
|
||||
mov x30, #2
|
||||
/* test-gdb-x30 */
|
||||
|
||||
/* Exit required since we meesed up with x30 which is the lr. */
|
||||
mov x0, #0
|
||||
bl exit
|
||||
10
baremetal/arch/aarch64/regs.py
Normal file
10
baremetal/arch/aarch64/regs.py
Normal file
@@ -0,0 +1,10 @@
|
||||
def test(self):
|
||||
self.sendline('tbreak main')
|
||||
self.sendline('continue')
|
||||
self.continue_to('x1')
|
||||
self.sendline('set $x30 = 3')
|
||||
self.continue_to('x29')
|
||||
assert self.get_int('$x29') == 1
|
||||
assert self.get_int('$x30') == 3
|
||||
self.continue_to('x30')
|
||||
assert self.get_int('$x30') == 2
|
||||
Reference in New Issue
Block a user