Code: Select all
_isr1:
cli
push byte 0
push byte 1
jmp isr_common_stub
In this case, why push a byte, not a DWORD?
Code: Select all
_isr1:
cli
push byte 0
push byte 1
jmp isr_common_stub
Code: Select all
void isr(unsigned char isr, unsigned int err) {
/* Code in here */
}
I had a look at NASMs -Ox option (http://www.nasm.us/doc/nasmdoc2.html#section-2.1.22), but I don't see how it relates to PUSH with BYTE, DWORD, etc...since then the -Ox option has been introduced in NASM, which takes care of "push byte ..." and "add dword [...],byte ..."
I did find that when I was pushing larger numbers for higher interrupts (eg, > 128), NASM didn't like using BYTE.berkus wrote:Which problems exactly?
Code: Select all
void idt_entries(uword i, udword base, uword selector, ubyte flags) {
idt[i].lowoffset = base & 0xFFFF;
idt[i].selector = selector;
idt[i].reserved = 0;
idt[i].flags = flags;
idt[i].highoffset = (base >> 16) & 0xFFFF;
}
Code: Select all
idtr.limit = (sizeof((udword)idt) * IDTDESCRIPTORS) - 1;
idtr.base = (udword)&idt;
idt_entries (0, (udword)isr0, 0x08, 0x8e);
idt_entries (1, (udword)isr1, 0x08, 0x8e);
idt_entries (2, (udword)isr2, 0x08, 0x8e);
...
Code: Select all
_isr213:
CLI
PUSH BYTE 0
PUSH DWORD 213
JMP isrhandler
isrhandler:
MOV EAX, _isr
CALL EAX
ADD ESP, 8
IRET
would a simple pusha and popa be suitable to preserve registers?Combuster wrote:Your ISRs don't preserve registers.
Code: Select all
isrhandler:
PUSHA
MOV EAX, _isr
CALL EAX
POPA
ADD ESP, 8
IRET