summaryrefslogtreecommitdiffstats
path: root/src/c_cpu.S
diff options
context:
space:
mode:
authorJozanLeClerc <>2022-05-22 15:12:53 +0000
committerJozanLeClerc <>2022-05-22 15:12:53 +0000
commit9cab06121021ce8fb4626dfdbe34ef50bf55f182 (patch)
tree6578a576da71394e92598224af901aa60e59e9fa /src/c_cpu.S
parentAdded (diff)
downloadasm-cgi-example-9cab06121021ce8fb4626dfdbe34ef50bf55f182.tar.gz
asm-cgi-example-9cab06121021ce8fb4626dfdbe34ef50bf55f182.tar.bz2
asm-cgi-example-9cab06121021ce8fb4626dfdbe34ef50bf55f182.tar.xz
asm-cgi-example-9cab06121021ce8fb4626dfdbe34ef50bf55f182.tar.zst
asm-cgi-example-9cab06121021ce8fb4626dfdbe34ef50bf55f182.zip
Update
FossilOrigin-Name: 34d2b122f1068e995b1a752fbfc9d37878cf4e80
Diffstat (limited to 'src/c_cpu.S')
-rw-r--r--src/c_cpu.S47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/c_cpu.S b/src/c_cpu.S
index 1c5a30c..395b176 100644
--- a/src/c_cpu.S
+++ b/src/c_cpu.S
@@ -50,6 +50,15 @@ c_cpu:
fork_model:
xorq %rdi, %rdi
xorq %rsi, %rsi
+ xorq %rdx, %rdx
+ xorq %rax, %rax
+ movb $0x1, %dil
+ movq $str_model, %rsi
+ movq $len_model, %rdx
+ movb $0x4, %al /* SYS_write */
+ syscall
+ xorq %rdi, %rdi
+ xorq %rsi, %rsi
xorq %rax, %rax
movb $0x2, %al /* SYS_fork */
syscall
@@ -61,6 +70,15 @@ fork_model:
fork_ncpu:
xorq %rdi, %rdi
xorq %rsi, %rsi
+ xorq %rdx, %rdx
+ xorq %rax, %rax
+ movb $0x1, %dil
+ movq $str_ncpu, %rsi
+ movq $len_ncpu, %rdx
+ movb $0x4, %al /* SYS_write */
+ syscall
+ xorq %rdi, %rdi
+ xorq %rsi, %rsi
xorq %rax, %rax
movb $0x2, %al /* SYS_fork */
syscall
@@ -72,6 +90,15 @@ fork_ncpu:
fork_lscpu:
xorq %rdi, %rdi
xorq %rsi, %rsi
+ xorq %rdx, %rdx
+ xorq %rax, %rax
+ movb $0x1, %dil
+ movq $str_lscpu, %rsi
+ movq $len_lscpu, %rdx
+ movb $0x4, %al /* SYS_write */
+ syscall
+ xorq %rdi, %rdi
+ xorq %rsi, %rsi
xorq %rax, %rax
movb $0x2, %al /* SYS_fork */
syscall
@@ -154,6 +181,17 @@ wait_lscpu:
xorq %rax, %rax
movb $0x7, %al /* sys_wait4 */
syscall
+
+write_end:
+ xorq %rdi, %rdi
+ xorq %rsi, %rsi
+ xorq %rdx, %rdx
+ xorq %rax, %rax
+ movb $0x1, %dil
+ movq $str_end, %rsi
+ movq $len_end, %rdx
+ movb $0x4, %al /* SYS_write */
+ syscall
retq
err:
@@ -164,7 +202,14 @@ err:
syscall
.data
-# sysctl hw.model\n\t\t\tsysctl hw.ncpu\n\t\t\tlscpu
+ str_model: .asciz "\t\t<p>\n\t\t\t<code>sysctl hw.model</code>:\n\t\t</p>\n\t\t<pre>\n"
+ len_model = . - str_model
+ str_ncpu: .asciz "\t\t</pre>\n\t\t<p>\n\t\t\t<code>sysctl hw.ncpu</code>:\n\t\t</p>\n\t\t<pre>\n"
+ len_ncpu = . - str_ncpu
+ str_lscpu: .asciz "\t\t</pre>\n\t\t<p>\n\t\t\t<code>lscpu</code>:\n\t\t</p>\n\t\t<pre>\n"
+ len_lscpu = . - str_lscpu
+ str_end: .asciz "\t\t</pre>\n"
+ len_end = . - str_end
sysctl: .asciz "/sbin/sysctl"
lscpu: .asciz "/usr/local/bin/lscpu"
model: .asciz "hw.model"