assembly

Printf arguments not pushed on the stack

放肆的年华 提交于 2021-02-10 13:09:03
问题 I'm in the process of trying to understand the stack mechanisms. From the theory I have seen, before a function is called, its arguments are pushed onto the stack. However when calling printf in the code below, none of them are pushed: #include<stdio.h> int main(){ char *s = " test string"; printf("Print this: %s and this %s \n", s, s); return 1; } I've put a break in gdb to the printf instruction, and when displaying the stack, none of the 3 arguments are pushed onto the stack. The only

Location and Highest value in array

做~自己de王妃 提交于 2021-02-10 12:18:41
问题 So i am trying learn assembly and my practice sheet has an example where i have to create a program to input 10 numbers one at a time into an array. I have to print the highest value and when it was entered. I have barely any exp in comparing but I want to somehow store the high value and compare it the locations? code: include irvine32.inc .data num dw 10 dup(0) count db 1 prompt db "Enter a number: ",0 yesMsg db "hi val is in location ",0 hiMsg db "The high value is ",0 .code main proc mov

Location and Highest value in array

╄→гoц情女王★ 提交于 2021-02-10 12:18:25
问题 So i am trying learn assembly and my practice sheet has an example where i have to create a program to input 10 numbers one at a time into an array. I have to print the highest value and when it was entered. I have barely any exp in comparing but I want to somehow store the high value and compare it the locations? code: include irvine32.inc .data num dw 10 dup(0) count db 1 prompt db "Enter a number: ",0 yesMsg db "hi val is in location ",0 hiMsg db "The high value is ",0 .code main proc mov

Location and Highest value in array

自古美人都是妖i 提交于 2021-02-10 12:18:07
问题 So i am trying learn assembly and my practice sheet has an example where i have to create a program to input 10 numbers one at a time into an array. I have to print the highest value and when it was entered. I have barely any exp in comparing but I want to somehow store the high value and compare it the locations? code: include irvine32.inc .data num dw 10 dup(0) count db 1 prompt db "Enter a number: ",0 yesMsg db "hi val is in location ",0 hiMsg db "The high value is ",0 .code main proc mov

is this the right way to use cbw in Mul?

放肆的年华 提交于 2021-02-10 11:58:14
问题 I get the Multiplication from 8bit and 8bit register. But, when you have one in 16 bit, and one in 8bit, how do we do the conversion before multiplying: Question : need to provide code fragments for 260*19, and print the results. I did: mov Ax,260 mov Al,19 cbw; Mul Ax PutInt Ax 回答1: mov Ax,260 mov Al,19 The AL register is the lowest half of the AX register. AX /-----------------\ MSB xxxx xxxx xxxx xxxx LSB \-------/ \-------/ AH AL The 2nd instruction mov al, 19 thus erroneously overwrites

is this the right way to use cbw in Mul?

眉间皱痕 提交于 2021-02-10 11:52:06
问题 I get the Multiplication from 8bit and 8bit register. But, when you have one in 16 bit, and one in 8bit, how do we do the conversion before multiplying: Question : need to provide code fragments for 260*19, and print the results. I did: mov Ax,260 mov Al,19 cbw; Mul Ax PutInt Ax 回答1: mov Ax,260 mov Al,19 The AL register is the lowest half of the AX register. AX /-----------------\ MSB xxxx xxxx xxxx xxxx LSB \-------/ \-------/ AH AL The 2nd instruction mov al, 19 thus erroneously overwrites

BCM2708 (RPi) Rasbpian FIQ not triggered

风格不统一 提交于 2021-02-10 11:46:23
问题 I have written a Linux Loadable Kernel Module which attempts to attach to the FIQ to service GPIO edge transistions. The Pin in question is on GPIO0 (IRQ 49) so I attempt to configure the FIQ as follows: #ifndef GPIO_BASE #define GPIO_BASE 0x7E200000 #endif #define GPIO_LEN 0x60 #define GPIO_GPEDS0 0x10 #define GPIO_GPEDS1 0x11 #define GPIO_GPREN0 0x13 #define GPIO_GPREN1 0x14 #define GPIO_GPFEN0 0x16 #define GPIO_GPFEN1 0x17 #define AIR_BASE 0x7E00B200 #define AIR_LEN 0x28 #define AIR_IP2 2

Why movzbl is used in assembly when casting unsigned char to signed data types?

风流意气都作罢 提交于 2021-02-10 11:37:04
问题 I'm learning data movement( MOV ) in assembly. I tried to compile some code to see the assembly in a x86_64 Ubuntu 18.04 machine: typedef unsigned char src_t; typedef xxx dst_t; dst_t cast(src_t *sp, dst_t *dp) { *dp = (dst_t)*sp; return *dp; } where src_t is unsigned char . As for the dst_t , I tried char , short , int and long . The result is shown below: // typedef unsigned char src_t; // typedef char dst_t; // movzbl (%rdi), %eax // movb %al, (%rsi) // typedef unsigned char src_t; //

Why movzbl is used in assembly when casting unsigned char to signed data types?

回眸只為那壹抹淺笑 提交于 2021-02-10 11:36:30
问题 I'm learning data movement( MOV ) in assembly. I tried to compile some code to see the assembly in a x86_64 Ubuntu 18.04 machine: typedef unsigned char src_t; typedef xxx dst_t; dst_t cast(src_t *sp, dst_t *dp) { *dp = (dst_t)*sp; return *dp; } where src_t is unsigned char . As for the dst_t , I tried char , short , int and long . The result is shown below: // typedef unsigned char src_t; // typedef char dst_t; // movzbl (%rdi), %eax // movb %al, (%rsi) // typedef unsigned char src_t; //

Calling an assembly function from C

别等时光非礼了梦想. 提交于 2021-02-10 07:44:45
问题 One of my generated functions doesn't compute what it should and I am trying to debug it separately. I have the assembler for it and I try to call it from a stripped down C program. However, for some reason I end up getting segfaults in the function (so, calling the function seems to work, but execution fails). There might be something wrong with passing the arguments.. The functions signature is void func(int, int, float*, float*, float*); The function ignores the first two arguments and