mov
này để move data từ memory vào register này
mov
này để move data từ memory vào register này.
replies
six forty-eight AM.
```Machine instructions generally fall into three categories: data movement, arithmetic/logic, and control-flow. In this section, we will look at important examples of x86 instructions from each category. This section should not be considered an exhaustive list of x86 instructions, but rather a useful subset. For a complete list, see Intel's instruction set reference.
We use the following notation:
<reg32> Any 32-bit register (EAX, EBX, ECX, EDX, ESI, EDI, ESP, or EBP)
<reg16> Any 16-bit register (AX, BX, CX, or DX)
<reg8> Any 8-bit register (AH, BH, CH, DH, AL, BL, CL, or DL)
<reg> Any register
<mem> A memory address (e.g., [eax], [var + 4], or dword ptr [eax+ebx])
<con32> Any 32-bit constant
<con16> Any 16-bit constant
<con8> Any 8-bit constant
<con> Any 8-, 16-, or 32-bit constant
```
```Machine instructions generally fall into three categories: data movement, arithmetic/logic, and control-flow. In this section, we will look at important examples of x86 instructions from each category. This section should not be considered an exhaustive list of x86 instructions, but rather a useful subset. For a complete list, see Intel's instruction set reference.. replies six fifty-three AM.
We use the following notation:
<reg32> Any 32-bit register (EAX, EBX, ECX, EDX, ESI, EDI, ESP, or EBP)
<reg16> Any 16-bit register (AX, BX, CX, or DX)
<reg8> Any 8-bit register (AH, BH, CH, DH, AL, BL, CL, or DL)
<reg> Any register
<mem> A memory address (e.g., [eax], [var + 4], or dword ptr [eax+ebx])
<con32> Any 32-bit constant
<con16> Any 16-bit constant
<con8> Any 8-bit constant
<con> Any 8-, 16-, or 32-bit constant
```
```32 bits : EAX EBX ECX EDX
16 bits : AX BX CX DX
8 bits : AH AL BH BL CH CL DH DL
```
```32 bits : EAX EBX ECX EDX. replies six fifty-five AM.
16 bits : AX BX CX DX
8 bits : AH AL BH BL CH CL DH DL
```
```Some examples of mov instructions using address computations are:
mov eax, [ebx] ; Move the 4 bytes in memory at the address contained in EBX into EAX
mov [var], ebx ; Move the contents of EBX into the 4 bytes at memory address var. (Note, var is a 32-bit constant).
mov eax, [esi-4] ; Move 4 bytes at memory address ESI + (-4) into EAX
mov [esi+eax], cl ; Move the contents of CL into the byte at address ESI+EAX
mov edx, [esi+4*ebx] ; Move the 4 bytes of data at address ESI+4*EBX into EDX
```
```Some examples of mov instructions using address computations are:. replies six fifty-seven AM.
mov eax, [ebx] ; Move the 4 bytes in memory at the address contained in EBX into EAX
mov [var], ebx ; Move the contents of EBX into the 4 bytes at memory address var. (Note, var is a 32-bit constant).
mov eax, [esi-4] ; Move 4 bytes at memory address ESI + (-4) into EAX
mov [esi+eax], cl ; Move the contents of CL into the byte at address ESI+EAX
mov edx, [esi+4*ebx] ; Move the 4 bytes of data at address ESI+4*EBX into EDX
```
```Modern (i.e 386 and beyond) x86 processors have eight 32-bit general purpose registers, as depicted in Figure 1. The register names are mostly historical. For example, EAX used to be called the accumulator since it was used by a number of arithmetic operations, and ECX was known as the counter since it was used to hold a loop index. Whereas most of the registers have lost their special purposes in the modern instruction set, by convention, two are reserved for special purposes — the stack pointer (ESP) and the base pointer (EBP).
For the EAX, EBX, ECX, and EDX registers, subsections may be used. For example, the least significant 2 bytes of EAX can be treated as a 16-bit register called AX. The least significant byte of AX can be used as a single 8-bit register called AL, while the most significant byte of AX can be used as a single 8-bit register called AH. These names refer to the same physical register. When a two-byte quantity is placed into DX, the update affects the value of DH, DL, and EDX. These sub-registers are mainly hold-overs from older, 16-bit versions of the instruction set. However, they are sometimes convenient when dealing with data that are smaller than 32-bits (e.g. 1-byte ASCII characters).
```
```Modern (i.e 386 and beyond) x86 processors have eight 32-bit general purpose registers, as depicted in Figure 1. The register names are mostly historical. For example, EAX used to be called the accumulator since it was used by a number of arithmetic operations, and ECX was known as the counter since it was used to hold a loop index. Whereas most of the registers have lost their special purposes in the modern instruction set, by convention, two are reserved for special purposes — the stack pointer (ESP) and the base pointer (EBP).. replies seven o'clock AM.
For the EAX, EBX, ECX, and EDX registers, subsections may be used. For example, the least significant 2 bytes of EAX can be treated as a 16-bit register called AX. The least significant byte of AX can be used as a single 8-bit register called AL, while the most significant byte of AX can be used as a single 8-bit register called AH. These names refer to the same physical register. When a two-byte quantity is placed into DX, the update affects the value of DH, DL, and EDX. These sub-registers are mainly hold-overs from older, 16-bit versions of the instruction set. However, they are sometimes convenient when dealing with data that are smaller than 32-bits (e.g. 1-byte ASCII characters).
```
```long a = 0;(edited)
Thread thread1 = new Thread() {
a = 100;
}
Thread thread2 = new Thread() {
System.out.println(a + 1);
}
```
```long a = 0;. replies seven sixteen AM. Edited.
Thread thread1 = new Thread() {
a = 100;
}
Thread thread2 = new Thread() {
System.out.println(a + 1);
}
```
a
có thể nhận những giá trị nào?
a
có thể nhận những giá trị nào?.
replies
seven seventeen AM.
100
bằng một số 64 bít thì sao?
100
bằng một số 64 bít thì sao?.
replies
seven twenty-five AM.
a = 2^64 - 1
a = 2^64 - 1
.
replies
seven twenty-six AM.
mov
mov
.
replies
seven twenty-seven AM.
mov
số 1, thì thread2 chạy luôn, và chạy trước xong trước khi thread1 chạy lệnh mov
còn lại
mov
số 1, thì thread2 chạy luôn, và chạy trước xong trước khi thread1 chạy lệnh mov
còn lại.
replies
seven twenty-seven AM.
```T[] a = new T[10];
a[0] = 0;
a[1] = 0;
Thread t1 = new Thread() {
a[0] = 10;
}
Thread t2 = new Thread() {
System.out.println(a[1])
}
```
```T[] a = new T[10];. replies seven forty AM.
a[0] = 0;
a[1] = 0;
Thread t1 = new Thread() {
a[0] = 10;
}
Thread t2 = new Thread() {
System.out.println(a[1])
}
```
a[0] = 10;
thành CPU instruction, với chú ý là các thanh ghi phải có size là 8, 16, 32, 64
a[0] = 10;
thành CPU instruction, với chú ý là các thanh ghi phải có size là 8, 16, 32, 64.
replies
seven fifty-two AM.
```x = a + 1
b = 10
c = a + 3
```
```x = a + 1
c = a + 3
b = 10
```
```x = a + 1
b = 10
c = a + 3
```
```x = a + 1. replies eight twenty-one AM.
c = a + 3
b = 10
```
x = a + 1
, CPU thuc hien 1 phep cong 2 so, va 1 trong 2 so do la so a
, nen neu thuc hien tiep phep dong voi a
, thi do mat cong load a tu memory vao register
x = a + 1
, CPU thuc hien 1 phep cong 2 so, va 1 trong 2 so do la so a
, nen neu thuc hien tiep phep dong voi a
, thi do mat cong load a tu memory vao register.
replies
eight twenty-one AM.