flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Segment Register Causing Interrupts to Hang [Solved] |
Author |
|
revolution 10 Oct 2012, 01:11
Those codes change because you are looking at the next instruction jb/loop:
Code: cmp BYTE [FS:SI], 'a' ;64 80 3D 61 jb WriteFileNameLetterIsAlreadyCapital ;72 06 sub BYTE [FS:SI], 0x20; 64 80 2D 20 inc si ;47 loop WriteCapitalizeFileNameLoop ;E2 F1 We can't help you with the small section of code you have posted. Perhaps you can give a minimal compilable example showing your problem. |
|||
10 Oct 2012, 01:11 |
|
XtremeDude47 10 Oct 2012, 11:31
Of course! I hadn't realised that I had included the jb and loop instructions! Although in retrospect, I should have figured that something wasn't quite right with the 6/7 byte instructions!
Anyhow, I've been playing around with the code a bit, and I've discovered that its not the segment register which causes this problem, but rather the segment that the segment register points to. I'm still not sure why this is happening, though, as I've been pointing my segment registers to that same segment without any problems up until now. I would give a minimal compilable example, however I've been unable to reproduce the problem independantly, so theoretically, the actual code is fine, but there is a problem with that code when implemented into the kernel. I understand that not much can be done with that small snippet of code I've provided, however its the best I can provide without the whole Kernel source, which is huge, messy and is 98% irrelevant code - but its the only place where the problem can be reproduced at this point. I'll check the code again and provide the kernel along with anything else I find is relevant. EDIT: I found the cause of the problem! Before all this, in my read function I used the unpadded file name length as a counter to capitalise the filename before it was padded, I then copied that same code to my write function, which capitalises the filename after its padded. I knew that after the filename was padded it would always be 11 bytes long, so I removed: Code: mov cx, WORD[FS:UnpaddedFileNameLength] ; I also just realised that I forgot to correct this for the first snippet in my first post from the beginning of the code, and in a moment of stupidity, I somehow forgot to replace it with: Code: mov cx, 0x000B When I posted the code earlier, I noticed that this was missing, however I thought that I simply didn't select that line while copy-pasting, so I put it in the code in my first post, but not in my actual code! Consequently, because of some large, arbitrary CX value from previous compuatations, my function kept modifying bytes past the filename, and eventually overwrote my interrupts in memory! (because the kernel data area is 'before' the ISR area) The specific erroneous segment that I mentioned earlier causes interrupts to hang because that is both my kernel's data and code segment, hence, by using a different segment, the ISR's weren't being overwritten! Anyhow, here is the working code if anyone wants it: Code: ;Note-DI:SI points to the filename ;mov cx, WORD[FS:UnpaddedFileNameLength] ; CX value used for this loop in the FAT12 read function mov cx, 0x000B ; I forgot to add this in my kernel! WriteCapitalizeFileNameLoop: cmp BYTE [FS:SI], 'a' jb WriteFileNameLetterIsAlreadyCapital sub BYTE [FS:SI], 0x20 ; -32 to make it a capital letter WriteFileNameLetterIsAlreadyCapital: inc si ; increment SI to capitalise the next character loop WriteCapitalizeFileNameLoop Thanks revolution! |
|||
10 Oct 2012, 11:31 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.