From 6c0655e7dfd83b726eeec71ecb72e29f5ef0a8d4 Mon Sep 17 00:00:00 2001 From: JozanLeClerc <> Date: Sun, 22 May 2022 16:30:43 +0000 Subject: WIP FossilOrigin-Name: 50c6fcb1c1758fb6252c48df702f81c626389bcc --- src/c_example.S | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/c_example.S') diff --git a/src/c_example.S b/src/c_example.S index 17b2f34..652f688 100644 --- a/src/c_example.S +++ b/src/c_example.S @@ -39,12 +39,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * asm-cgi-example: src/c_example.S - * Sun May 22 16:51:38 CEST 2022 + * Sun May 22 17:17:07 CEST 2022 * Joe */ .text .extern c_cpu +.extern c_infos .globl main main: @@ -59,12 +60,21 @@ write_begin: movb $0x4, %al /* SYS_write */ syscall +infos: + callq c_infos + cpu: - callq c_cpu + xorq %rdi, %rdi + xorq %rax, %rax + movb $0x1, %dil + movq $str_h2cpu, %rsi + movq $len_h2cpu, %rdx + movb $0x4, %al /* SYS_write */ + syscall + # callq c_cpu write_end: xorq %rdi, %rdi - xorq %rsi, %rsi xorq %rax, %rax movb $0x1, %dil movq $str_end, %rsi @@ -77,7 +87,9 @@ end: retq .data - str_begin: .ascii "Content-type: text/html\n\n\n\t\n\t\tTitle\n\t\n\t\n\t\t

asm-cgi-example

\n\t\t

\n\t\t\tThis page was generated by a small assembly program. It will run some shell commands for you. It's pointless in essence but I am trying to prove a point.\n\t\t

\n\t\t

Some CPU infos

\n\t\t

\n\t\t\tLet's fetch some infos about this server's CPU.\n\t\t

\n" + str_begin: .ascii "Content-type: text/html\n\n\n\t\n\t\tTitle\n\t\n\t\n\t\t

asm-cgi-example

\n\t\t

\n\t\t\tThis page was generated by a small assembly program. It will run some shell commands for you. It's pointless in essence but I am trying to prove a point.\n\t\t

\n\t\t

General infos

\n\t\t

\n\t\t\tLet's fetch some general informations first.\n\t\t

\n" len_begin = . - str_begin + str_h2cpu: .ascii "\t\t

Some CPU infos

\n\t\t

\n\t\t\tNow let's fetch some infos about this server's CPU.\n\t\t

\n" + len_h2cpu = . - str_h2cpu str_end: .ascii "\t\n\n" len_end = . - str_end -- cgit v1.2.3