Assembly change char in str [Not Working] The Next CEO of Stack OverflowWhen is assembly faster than C?8086 ASM: Turbodebugger opens text file, executing normally doesn'tFloating point exceptions in x86 NASM assembly using div instructionTracing call stack in disassembled codeSnake Game Assembly: increasing body length not workingSnake Game: how to know if it bites itselfC++ code for testing the Collatz conjecture faster than hand-written assembly - why?Writing 64 bit assembly based on 32 bit assemblyAvoiding the JMP in the JMP CALL POP technique for shellcode NASM?AT&T x86 64bit compute power of
My ex-girlfriend uses my Apple ID to login to her iPad, do I have to give her my Apple ID password to reset it?
Traveling with my 5 year old daughter (as the father) without the mother from Germany to Mexico
Read/write a pipe-delimited file line by line with some simple text manipulation
A hang glider, sudden unexpected lift to 25,000 feet altitude, what could do this?
What day is it again?
The sum of any ten consecutive numbers from a fibonacci sequence is divisible by 11
What are the unusually-enlarged wing sections on this P-38 Lightning?
Can I cast Thunderwave and be at the center of its bottom face, but not be affected by it?
Is there a rule of thumb for determining the amount one should accept for of a settlement offer?
Why did Batya get tzaraat?
Cannot restore registry to default in Windows 10?
How can I prove that a state of equilibrium is unstable?
What does it mean 'exit 1' for a job status after rclone sync
How seriously should I take size and weight limits of hand luggage?
What is the difference between 'contrib' and 'non-free' packages repositories?
Creating a script with console commands
Is it a bad idea to plug the other end of ESD strap to wall ground?
What steps are necessary to read a Modern SSD in Medieval Europe?
Variance of Monte Carlo integration with importance sampling
Salesforce opportunity stages
Is a linearly independent set whose span is dense a Schauder basis?
How to find if SQL server backup is encrypted with TDE without restoring the backup
What happens if you break a law in another country outside of that country?
Is it okay to majorly distort historical facts while writing a fiction story?
Assembly change char in str [Not Working]
The Next CEO of Stack OverflowWhen is assembly faster than C?8086 ASM: Turbodebugger opens text file, executing normally doesn'tFloating point exceptions in x86 NASM assembly using div instructionTracing call stack in disassembled codeSnake Game Assembly: increasing body length not workingSnake Game: how to know if it bites itselfC++ code for testing the Collatz conjecture faster than hand-written assembly - why?Writing 64 bit assembly based on 32 bit assemblyAvoiding the JMP in the JMP CALL POP technique for shellcode NASM?AT&T x86 64bit compute power of
Simple question why that's not working ?
mov al, [rdi]
add al, 32
mov [rdi], al
I don't know why but with this code i have a segmentation fault ...
Of course rdi is a string
Ps : I have this code in a program so maybe that's not why i have segmentation fault, but i pretty sure the error come's from there
Here is the full code :
BITS 64
section .text
global mystrcasecmp
global _loopCount_strcasecmp
global _exit_strcasecmp
global _r9_upper_strcasecmp
global _r8_upper_strcasecmp
global _upper_sentence_rdi_strcasecmp
global _upper_sentence_rsi_strcasecmp
mystrcasecmp:
;1 = rdi
;2 = rsi
mov rcx, 0
jmp _upper_sentence_rdi_strcasecmp
_r9_upper_strcasecmp:
cmp al, 90
jg _upper_sentence_rdi_strcasecmp
add al, 32
mov [rdi], al // SEG HERE
_upper_sentence_rdi_strcasecmp:
mov al, [rdi]
cmp al, 0
je _upper_sentence_rsi_strcasecmp
cmp al, 65
jge _r9_upper_strcasecmp
inc rdi
jmp _upper_sentence_rdi_strcasecmp
_r8_upper_strcasecmp:
cmp al, 90
jg _upper_sentence_rsi_strcasecmp
add al, 32
mov [rsi], al
_upper_sentence_rsi_strcasecmp:
mov al, [rsi]
cmp al, 0
je _loopCount_strcasecmp
cmp al, 65
jge _r8_upper_strcasecmp
inc rsi
jmp _upper_sentence_rsi_strcasecmp
; A = 65 Z = 90
; a = 97 z = 122
_loopCount_strcasecmp:
mov r9b, [rdi + rcx]
mov r8b, [rsi + rcx]
cmp r9b, r8b
jne _exit_strcasecmp
cmp r9b, 0
je _exit_strcasecmp
inc rcx
jmp _loopCount_strcasecmp
_exit_strcasecmp:
;mov dans un registre pas de meme taille
sub r9b, r8b
movsx rax, r9b
ret
assembly x86-64
add a comment |
Simple question why that's not working ?
mov al, [rdi]
add al, 32
mov [rdi], al
I don't know why but with this code i have a segmentation fault ...
Of course rdi is a string
Ps : I have this code in a program so maybe that's not why i have segmentation fault, but i pretty sure the error come's from there
Here is the full code :
BITS 64
section .text
global mystrcasecmp
global _loopCount_strcasecmp
global _exit_strcasecmp
global _r9_upper_strcasecmp
global _r8_upper_strcasecmp
global _upper_sentence_rdi_strcasecmp
global _upper_sentence_rsi_strcasecmp
mystrcasecmp:
;1 = rdi
;2 = rsi
mov rcx, 0
jmp _upper_sentence_rdi_strcasecmp
_r9_upper_strcasecmp:
cmp al, 90
jg _upper_sentence_rdi_strcasecmp
add al, 32
mov [rdi], al // SEG HERE
_upper_sentence_rdi_strcasecmp:
mov al, [rdi]
cmp al, 0
je _upper_sentence_rsi_strcasecmp
cmp al, 65
jge _r9_upper_strcasecmp
inc rdi
jmp _upper_sentence_rdi_strcasecmp
_r8_upper_strcasecmp:
cmp al, 90
jg _upper_sentence_rsi_strcasecmp
add al, 32
mov [rsi], al
_upper_sentence_rsi_strcasecmp:
mov al, [rsi]
cmp al, 0
je _loopCount_strcasecmp
cmp al, 65
jge _r8_upper_strcasecmp
inc rsi
jmp _upper_sentence_rsi_strcasecmp
; A = 65 Z = 90
; a = 97 z = 122
_loopCount_strcasecmp:
mov r9b, [rdi + rcx]
mov r8b, [rsi + rcx]
cmp r9b, r8b
jne _exit_strcasecmp
cmp r9b, 0
je _exit_strcasecmp
inc rcx
jmp _loopCount_strcasecmp
_exit_strcasecmp:
;mov dans un registre pas de meme taille
sub r9b, r8b
movsx rax, r9b
ret
assembly x86-64
2
Presumably because your string is read-only. But this is not a Minimal, Complete, and Verifiable example so we can't tell.
– Jester
Mar 8 at 19:08
How can i make a string editable @Jester
– APoorDev
Mar 8 at 19:09
I put my code there I have the seg where i put the comment . I really don't know why i am segfaulting ...
– APoorDev
Mar 8 at 19:13
2
Show your string and how you pass it. If you do it from C, make sure it's a writable char array.
– Jester
Mar 8 at 19:22
I'd recommend taking the advice of Jester and posting the code (C?) that calls this function and declares all the variables.Without such information, getting help for your question will be difficult.
– Michael Petch
Mar 8 at 22:52
add a comment |
Simple question why that's not working ?
mov al, [rdi]
add al, 32
mov [rdi], al
I don't know why but with this code i have a segmentation fault ...
Of course rdi is a string
Ps : I have this code in a program so maybe that's not why i have segmentation fault, but i pretty sure the error come's from there
Here is the full code :
BITS 64
section .text
global mystrcasecmp
global _loopCount_strcasecmp
global _exit_strcasecmp
global _r9_upper_strcasecmp
global _r8_upper_strcasecmp
global _upper_sentence_rdi_strcasecmp
global _upper_sentence_rsi_strcasecmp
mystrcasecmp:
;1 = rdi
;2 = rsi
mov rcx, 0
jmp _upper_sentence_rdi_strcasecmp
_r9_upper_strcasecmp:
cmp al, 90
jg _upper_sentence_rdi_strcasecmp
add al, 32
mov [rdi], al // SEG HERE
_upper_sentence_rdi_strcasecmp:
mov al, [rdi]
cmp al, 0
je _upper_sentence_rsi_strcasecmp
cmp al, 65
jge _r9_upper_strcasecmp
inc rdi
jmp _upper_sentence_rdi_strcasecmp
_r8_upper_strcasecmp:
cmp al, 90
jg _upper_sentence_rsi_strcasecmp
add al, 32
mov [rsi], al
_upper_sentence_rsi_strcasecmp:
mov al, [rsi]
cmp al, 0
je _loopCount_strcasecmp
cmp al, 65
jge _r8_upper_strcasecmp
inc rsi
jmp _upper_sentence_rsi_strcasecmp
; A = 65 Z = 90
; a = 97 z = 122
_loopCount_strcasecmp:
mov r9b, [rdi + rcx]
mov r8b, [rsi + rcx]
cmp r9b, r8b
jne _exit_strcasecmp
cmp r9b, 0
je _exit_strcasecmp
inc rcx
jmp _loopCount_strcasecmp
_exit_strcasecmp:
;mov dans un registre pas de meme taille
sub r9b, r8b
movsx rax, r9b
ret
assembly x86-64
Simple question why that's not working ?
mov al, [rdi]
add al, 32
mov [rdi], al
I don't know why but with this code i have a segmentation fault ...
Of course rdi is a string
Ps : I have this code in a program so maybe that's not why i have segmentation fault, but i pretty sure the error come's from there
Here is the full code :
BITS 64
section .text
global mystrcasecmp
global _loopCount_strcasecmp
global _exit_strcasecmp
global _r9_upper_strcasecmp
global _r8_upper_strcasecmp
global _upper_sentence_rdi_strcasecmp
global _upper_sentence_rsi_strcasecmp
mystrcasecmp:
;1 = rdi
;2 = rsi
mov rcx, 0
jmp _upper_sentence_rdi_strcasecmp
_r9_upper_strcasecmp:
cmp al, 90
jg _upper_sentence_rdi_strcasecmp
add al, 32
mov [rdi], al // SEG HERE
_upper_sentence_rdi_strcasecmp:
mov al, [rdi]
cmp al, 0
je _upper_sentence_rsi_strcasecmp
cmp al, 65
jge _r9_upper_strcasecmp
inc rdi
jmp _upper_sentence_rdi_strcasecmp
_r8_upper_strcasecmp:
cmp al, 90
jg _upper_sentence_rsi_strcasecmp
add al, 32
mov [rsi], al
_upper_sentence_rsi_strcasecmp:
mov al, [rsi]
cmp al, 0
je _loopCount_strcasecmp
cmp al, 65
jge _r8_upper_strcasecmp
inc rsi
jmp _upper_sentence_rsi_strcasecmp
; A = 65 Z = 90
; a = 97 z = 122
_loopCount_strcasecmp:
mov r9b, [rdi + rcx]
mov r8b, [rsi + rcx]
cmp r9b, r8b
jne _exit_strcasecmp
cmp r9b, 0
je _exit_strcasecmp
inc rcx
jmp _loopCount_strcasecmp
_exit_strcasecmp:
;mov dans un registre pas de meme taille
sub r9b, r8b
movsx rax, r9b
ret
assembly x86-64
assembly x86-64
edited Mar 8 at 19:09
APoorDev
asked Mar 8 at 19:07
APoorDevAPoorDev
348
348
2
Presumably because your string is read-only. But this is not a Minimal, Complete, and Verifiable example so we can't tell.
– Jester
Mar 8 at 19:08
How can i make a string editable @Jester
– APoorDev
Mar 8 at 19:09
I put my code there I have the seg where i put the comment . I really don't know why i am segfaulting ...
– APoorDev
Mar 8 at 19:13
2
Show your string and how you pass it. If you do it from C, make sure it's a writable char array.
– Jester
Mar 8 at 19:22
I'd recommend taking the advice of Jester and posting the code (C?) that calls this function and declares all the variables.Without such information, getting help for your question will be difficult.
– Michael Petch
Mar 8 at 22:52
add a comment |
2
Presumably because your string is read-only. But this is not a Minimal, Complete, and Verifiable example so we can't tell.
– Jester
Mar 8 at 19:08
How can i make a string editable @Jester
– APoorDev
Mar 8 at 19:09
I put my code there I have the seg where i put the comment . I really don't know why i am segfaulting ...
– APoorDev
Mar 8 at 19:13
2
Show your string and how you pass it. If you do it from C, make sure it's a writable char array.
– Jester
Mar 8 at 19:22
I'd recommend taking the advice of Jester and posting the code (C?) that calls this function and declares all the variables.Without such information, getting help for your question will be difficult.
– Michael Petch
Mar 8 at 22:52
2
2
Presumably because your string is read-only. But this is not a Minimal, Complete, and Verifiable example so we can't tell.
– Jester
Mar 8 at 19:08
Presumably because your string is read-only. But this is not a Minimal, Complete, and Verifiable example so we can't tell.
– Jester
Mar 8 at 19:08
How can i make a string editable @Jester
– APoorDev
Mar 8 at 19:09
How can i make a string editable @Jester
– APoorDev
Mar 8 at 19:09
I put my code there I have the seg where i put the comment . I really don't know why i am segfaulting ...
– APoorDev
Mar 8 at 19:13
I put my code there I have the seg where i put the comment . I really don't know why i am segfaulting ...
– APoorDev
Mar 8 at 19:13
2
2
Show your string and how you pass it. If you do it from C, make sure it's a writable char array.
– Jester
Mar 8 at 19:22
Show your string and how you pass it. If you do it from C, make sure it's a writable char array.
– Jester
Mar 8 at 19:22
I'd recommend taking the advice of Jester and posting the code (C?) that calls this function and declares all the variables.Without such information, getting help for your question will be difficult.
– Michael Petch
Mar 8 at 22:52
I'd recommend taking the advice of Jester and posting the code (C?) that calls this function and declares all the variables.Without such information, getting help for your question will be difficult.
– Michael Petch
Mar 8 at 22:52
add a comment |
0
active
oldest
votes
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55069489%2fassembly-change-char-in-str-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55069489%2fassembly-change-char-in-str-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown

2
Presumably because your string is read-only. But this is not a Minimal, Complete, and Verifiable example so we can't tell.
– Jester
Mar 8 at 19:08
How can i make a string editable @Jester
– APoorDev
Mar 8 at 19:09
I put my code there I have the seg where i put the comment . I really don't know why i am segfaulting ...
– APoorDev
Mar 8 at 19:13
2
Show your string and how you pass it. If you do it from C, make sure it's a writable char array.
– Jester
Mar 8 at 19:22
I'd recommend taking the advice of Jester and posting the code (C?) that calls this function and declares all the variables.Without such information, getting help for your question will be difficult.
– Michael Petch
Mar 8 at 22:52