Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hdr/portab.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ static inline void enable(void)
static inline unsigned short getCS(void)
{
unsigned short ret;
asm volatile("mov %%cs, %0" : "=r"(ret));
asm volatile("{ mov %%cs, %0 | mov %0, cs }" : "=r"(ret));
return ret;
}

#define _SS getSS()
static inline unsigned short getSS(void)
{
unsigned short ret;
asm volatile("mov %%ss, %0" : "=r"(ret));
asm volatile("{ mov %%ss, %0 | mov %0, ss }" : "=r"(ret));
return ret;
}
extern char DosDataSeg[];
Expand Down
2 changes: 1 addition & 1 deletion kernel/chario.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ STATIC void fast_put_char(unsigned char chr)
_AL = chr;
__int__(0x29);
#elif defined(__GNUC__)
asm volatile("int $0x29":: "a"(chr):"bx");
asm volatile("{ int $0x29 | int 0x29 }":: "a"(chr):"bx");
#elif defined(I86)
asm
{
Expand Down
2 changes: 1 addition & 1 deletion kernel/inthndlr.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ VOID ASMCFUNC int21_syscall(iregs FAR * irp)
#if !defined __GNUC__ || defined __IA16_FEATURE_ATTRIBUTE_NO_ASSUME_SS_DATA
irp->DX = FP_SEG(os_release);
#else /* TODO: remove this hacky SS != DGROUP workaround --tkchia 20191207 */
asm volatile("movw %%ds, %0" : "=g" (irp->DX));
asm volatile("{ movw %%ds, %0 | mov %0, ds }" : "=g" (irp->DX));
#endif
irp->AX = FP_OFF(os_release);
}
Expand Down
2 changes: 1 addition & 1 deletion kernel/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ STATIC void CheckContinueBootFromHarddisk(void)

{
#if __GNUC__
asm volatile("jmp $0,$0x7c00");
asm volatile("{ jmp $0,$0x7c00 | jmp 0,0x7c00 }"::);
#else
void (far *reboot)(void) = (void (far*)(void)) MK_FP(0x0,0x7c00);

Expand Down
4 changes: 2 additions & 2 deletions kernel/prf.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void put_console(int c)
__int__(0xe6);
#elif defined(__GNUC__)
asm volatile(
"int $0xe6\n"
"{ int $0xe6 | int 0xe6 }"
: /* outputs */
: /* inputs */ "a"(0x13), "e"(FP_SEG(buff)), "d"(FP_OFF(buff))
);
Expand Down Expand Up @@ -126,7 +126,7 @@ void put_console(int c)
fastComPrint(c);
#endif
#elif defined(__GNUC__)
asm volatile("int $0x29" : : "a"(c) : "bx");
asm volatile("{ int $0x29 | int 0x29 }" : : "a"(c) : "bx");
#elif defined(I86)
__asm
{
Expand Down
21 changes: 18 additions & 3 deletions sys/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,25 @@ struct _diskfree_t {
int int86x(int ivec, union REGS *in, union REGS *out, struct SREGS *s)
{
/* must save sp for int25/26 */
asm("mov %7, %%cs:(1f+1); jmp 0f; 0:"
asm("{"
"mov %7, %%cs:(1f+1); jmp 0f; 0:"
"mov %%di, %%dx; mov %%sp, %%di;"
"push %%di; push %%di;"
/* push twice to work both for int 25h/26h and int 21h */
"1:int $0x00; pop %%di; pop %%di;"
/* second pop always reads the correct SP value.
the first pop may read the FL left on stack. */
"mov %%di, %%sp; sbb %0, %0" :
"mov %%di, %%sp; sbb %0, %0;"
" | "
"mov byte ptr cs:[1f+1], %7; jmp 0f; 0:"
"mov dx, di; mov di, sp;"
"push di; push di;"
/* push twice to work both for int 25h/26h and int 21h */
"1:int 0x00; pop di; pop di;"
/* second pop always reads the correct SP value.
the first pop may read the FL left on stack. */
"mov sp, di; sbb %0, %0;"
"}" :
"=r"(out->x.cflag),
"=a"(out->x.ax), "=b"(out->x.bx), "=c"(out->x.cx), "=d"(out->x.dx),
"=e"(s->es), "=Rds"(s->ds) :
Expand All @@ -140,7 +151,11 @@ int intdos(union REGS *in, union REGS *out)

int intdosx(union REGS *in, union REGS *out, struct SREGS *s)
{
asm("push %%ds; mov %%bx, %%ds; int $0x21; pop %%ds; sbb %0, %0":
asm("{"
"push %%ds; mov %%bx, %%ds; int $0x21; pop %%ds; sbb %0, %0\n"
" | "
"push ds; mov ds, bx; int 0x21; pop ds; sbb %0, %0\n"
"}" :
"=r"(out->x.cflag), "=a"(out->x.ax) :
"a"(in->x.ax), "c"(in->x.cx), "d"(in->x.dx),
"D"(in->x.di), "S"(in->x.si), "b"(s->ds), "e"(s->es) :
Expand Down