ssh 172.16.3.178


1.
as -gstabs -o w-vs-x-and-extension.o w-vs-x-and-extension.s
ld -O0 w-vs-x-and-extension.o

(gdb) l 14
9	.globl _start
10	
11	_start:
12	ldr x0,#int
13	ldr w0,#int32
14	mov w8,#SYS_EXIT
15	mov x0,#0
16	svc #0
17	
18	.end
(gdb) b 12
Breakpoint 1 at 0x4000b0: file w-vs-x-and-extension.s, line 12.
(gdb) run
Starting program: /export/home/an23/solar/SCR/SCR2.1/ARM/TP17/a.out 

Breakpoint 1, _start () at w-vs-x-and-extension.s:12
12	ldr x0,#int
(gdb) i r x0 w0 w8
x0             0x0                 0
w0             0x0                 0
w8             0x0                 0
(gdb) step
13	ldr w0,#int32
(gdb) i r x0 w0 w8
x0             0x11223344aabbccdd  1234605617868164317
w0             0x11223344aabbccdd  1234605617868164317
w8             0x0                 0


2)

(gdb) l 14
9	.globl _start
10	
11	_start:
12	adr x1,int
13	ldr x0,[x1]
14	
15	adr x1,int32
16	ldr w0,[x1]
17	
18	sxtw x1,w0
(gdb) b 12
Breakpoint 1 at 0x4000b0: file w-vs-x-and-extension.s, line 12.
(gdb) i r w0 x0 x1
The program has no registers now.
(gdb) run
Starting program: /export/home/an23/solar/SCR/SCR2.1/ARM/TP17/a.out 

Breakpoint 1, _start () at w-vs-x-and-extension.s:12
12	adr x1,int
(gdb) i r w0 x0 x1
w0             0x0                 0
x0             0x0                 0
x1             0x0                 0
(gdb) s
13	ldr x0,[x1]
(gdb) i r w0 x0 x1
w0             0x0                 0
x0             0x0                 0
x1             0x4100d0            4260048
(gdb) s
15	adr x1,int32
(gdb) i r w0 x0 x1
w0             0x11223344aabbccdd  1234605617868164317
x0             0x11223344aabbccdd  1234605617868164317
x1             0x4100d0            4260048
(gdb) s
16	ldr w0,[x1]
(gdb) i r w0 x0 x1
w0             0x11223344aabbccdd  1234605617868164317
x0             0x11223344aabbccdd  1234605617868164317
x1             0x4100d8            4260056
(gdb) s
18	sxtw x1,w0
(gdb) i r w0 x0 x1
w0             0x887766ee          2289526510
x0             0x887766ee          2289526510
x1             0x4100d8            4260056
(gdb) 



II)


1)

(gdb) l  
1	.equ SYS_EXIT, 93
2	
3	.data
4	
5	int1: .quad 1
6	int2: .quad 2
7	
8	.text
9	.globl _start
10	
(gdb) b 9
Breakpoint 1 at 0x4000b0: file add-int.s, line 13.
(gdb) run
Starting program: /export/home/an23/solar/SCR/SCR2.1/ARM/TP17/a.out 

Breakpoint 1, _start () at add-int.s:13
13	adr x0,int1
(gdb) i r w x0 x1 x2 x3 x4
Invalid register `w'
(gdb) i r  x0 x1 x2 x3 x4
x0             0x0                 0
x1             0x0                 0
x2             0x0                 0
x3             0x0                 0
x4             0x0                 0
(gdb) s
14	adr x1,int2
(gdb) i r  x0 x1 x2 x3 x4
x0             0x4100d0            4260048
x1             0x0                 0
x2             0x0                 0
x3             0x0                 0
x4             0x0                 0
(gdb) s
15	ldr x2,[x0]
(gdb) i r  x0 x1 x2 x3 x4
x0             0x4100d0            4260048
x1             0x4100d8            4260056
x2             0x0                 0
x3             0x0                 0
x4             0x0                 0
(gdb) s
16	ldr x3,[x1]
(gdb) i r  x0 x1 x2 x3 x4
x0             0x4100d0            4260048
x1             0x4100d8            4260056
x2             0x1                 1
x3             0x0                 0
x4             0x0                 0
(gdb) s
18	add x4,x2,x3
(gdb) i r  x0 x1 x2 x3 x4
x0             0x4100d0            4260048
x1             0x4100d8            4260056
x2             0x1                 1
x3             0x2                 2
x4             0x0                 0
(gdb) s
20	mov w8,#SYS_EXIT
(gdb) i r  x0 x1 x2 x3 x4
x0             0x4100d0            4260048
x1             0x4100d8            4260056
x2             0x1                 1
x3             0x2                 2
x4             0x3                 3


2.

(gdb) l
1	.equ SYS_EXIT, 93
2	
3	.data
4	
5	int1: .word 1
6	int2: .word 2
7	
8	.text
9	.globl _start
10	
(gdb) b 9
Breakpoint 1 at 0x4000b0: file add-int32.s, line 13.
(gdb) i r w4 w2 w3
The program has no registers now.
(gdb) run
Starting program: /export/home/an23/solar/SCR/SCR2.1/ARM/TP17/a.out 

Breakpoint 1, _start () at add-int32.s:13
13	adr x0,int1
(gdb) i r w4 w2 w3
w4             0x0                 0
w2             0x0                 0
w3             0x0                 0
(gdb) s
14	adr x1,int2
(gdb) i r w4 w2 w3
w4             0x0                 0
w2             0x0                 0
w3             0x0                 0
(gdb) i r w4 w2 w3s
w4             0x0                 0
w2             0x0                 0
Invalid register `w3s'
(gdb) s
15	ldr w2,[x0]
(gdb) i r w4 w2 w3s
w4             0x0                 0
w2             0x0                 0
Invalid register `w3s'
(gdb) i r w4 w2 w3 
w4             0x0                 0
w2             0x0                 0
w3             0x0                 0
(gdb) s
16	ldr w3,[x1]
(gdb) i r w4 w2 w3 
w4             0x0                 0
w2             0x1                 1
w3             0x0                 0
(gdb) s && i r w4 w2 w3
A syntax error in expression, near `&& i r w4 w2 w3'.
(gdb) s
18	add w4,w2,w3
(gdb) i r w4 w2 w3 
w4             0x0                 0
w2             0x1                 1
w3             0x2                 2
(gdb) s
20	mov w8,#SYS_EXIT
(gdb) i r w4 w2 w3 
w4             0x3                 3
w2             0x1                 1
w3             0x2                 2


3)

(gdb) l
1	.equ SYS_EXIT, 93
2	
3	.data
4	
5	int1: .word 1
6	int2: .word 2
7	
8	.text
9	.globl _start
10	
(gdb) b 9
Breakpoint 1 at 0x4000b0: file adds-int32.s, line 13.
(gdb) s
The program is not being run.
(gdb) run
Starting program: /export/home/an23/solar/SCR/SCR2.1/ARM/TP17/a.out 

Breakpoint 1, _start () at adds-int32.s:13
13	adr x0,int1
(gdb) i r w3 w2 w1 x0
w3             0x0                 0
w2             0x0                 0
w1             0x0                 0
x0             0x0                 0
(gdb) s
14	adr x1,int2
(gdb) i r w3 w2 w1 x0
w3             0x0                 0
w2             0x0                 0
w1             0x0                 0
x0             0x4100d4            4260052
(gdb) s
15	ldr w2,[x0]
(gdb) s
16	ldr w3,[x1]
(gdb) s
18	adds w4,w2,w3
(gdb) i r w3 w2 w1 x0
w3             0x2                 2
w2             0x1                 1
w1             0x4100d8            4260056
x0             0x4100d4            4260052
(gdb) s
19	MRS x0,NZCV
(gdb) i r w3 w2 w1 x0
w3             0x2                 2
w2             0x1                 1
w1             0x4100d8            4260056
x0             0x4100d4            4260052
(gdb) s
21	mov w8,#SYS_EXIT
(gdb) i r w3 w2 w1 x0
w3             0x2                 2
w2             0x1                 1
w1             0x4100d8            4260056
x0             0x0                 0
(gdb) i r w3 w2 w1 x0 w4
w3             0x2                 2
w2             0x1                 1
w1             0x4100d8            4260056
x0             0x0                 0
w4             0x3                 3








