polmon: no moar es
This commit is contained in:
14
polmon.cc
14
polmon.cc
@@ -72,15 +72,15 @@ void puts(const char* s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// arguments on the stack in reverse order
|
// arguments on the stack in reverse order
|
||||||
extern "C" uint16_t Jump(uint16_t addr, int nargs);
|
extern "C" uint16_t FarJump(uint16_t addr, uint16_t seg, int nargs);
|
||||||
asm (
|
asm (
|
||||||
".section .text.Jump \n"
|
".section .text.FarJump \n"
|
||||||
"Jump: \n"
|
"FarJump: \n"
|
||||||
" push %bx \n"
|
" push %bx \n"
|
||||||
" push %si \n"
|
" push %si \n"
|
||||||
" push %di \n"
|
" push %di \n"
|
||||||
" push %bp \n"
|
" push %bp \n"
|
||||||
" push %es \n"
|
" push %cx \n" // seg
|
||||||
" push %ax \n" // addr
|
" push %ax \n" // addr
|
||||||
" movw %sp, %bp \n"
|
" movw %sp, %bp \n"
|
||||||
" movw %dx, %si \n" // nargs
|
" movw %dx, %si \n" // nargs
|
||||||
@@ -237,11 +237,11 @@ void Status(uint8_t status) {
|
|||||||
"movw $77, %%dx \n\t"
|
"movw $77, %%dx \n\t"
|
||||||
"int $0x10 \n\t"
|
"int $0x10 \n\t"
|
||||||
"movb %0, %%al \n\t"
|
"movb %0, %%al \n\t"
|
||||||
"call _ZN12_GLOBAL__N_110WriteUint8Eh \n\t"
|
"call %1 \n\t"
|
||||||
"movb $0x02, %%ah \n\t"
|
"movb $0x02, %%ah \n\t"
|
||||||
"movw %%di, %%dx \n\t"
|
"movw %%di, %%dx \n\t"
|
||||||
"int $0x10"
|
"int $0x10"
|
||||||
:: "rm" (status)
|
:: "rm" (status), "l" (WriteUint8)
|
||||||
: "ax", "bh", "dx", "cx", "di", "cc"
|
: "ax", "bh", "dx", "cx", "di", "cc"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -270,7 +270,7 @@ bool ParseCommand(const char* buf, uint16_t& cur_addr, uint16_t& cur_seg) {
|
|||||||
nargs++;
|
nargs++;
|
||||||
ptr += 4;
|
ptr += 4;
|
||||||
}
|
}
|
||||||
uint16_t ret = Jump(cur_addr, nargs);
|
uint16_t ret = FarJump(cur_addr, cur_seg, nargs);
|
||||||
asm volatile (
|
asm volatile (
|
||||||
"shl %0 \n\t"
|
"shl %0 \n\t"
|
||||||
"add %0, %%sp"
|
"add %0, %%sp"
|
||||||
|
Reference in New Issue
Block a user