You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with these compiler flags: /opt/wonderful/toolchain/gcc-ia16-elf/bin/ia16-elf-gcc -std=gnu11 -Wall -march=v30mz -mtune=v30mz -mregparmcall -ffreestanding -mcmodel=small -mno-callee-assume-ss-data-segment -msegelf -mno-segment-relocation-stuff -fexec-charset=shift-jis -Iinclude -Ibuild/cbin -I/opt/wonderful/target/wwitch/include -ffunction-sections -fdata-sections -O2 -MMD -MP -c -o build/src/main.c.o src/main.c, become the following machine code:
000000a4 <main>:
a4: 06 push %es
a5: 1e push %ds
a6: 07 pop %es
a7: e8 10 00 call ba <wwc_get_hardarch>
aa: 06 push %es
ab: 1f pop %ds
ac: e8 0b 00 call ba <wwc_get_hardarch>
af: 06 push %es
b0: 1f pop %ds
b1: e8 06 00 call ba <wwc_get_hardarch>
b4: 06 push %es
b5: 1f pop %ds
b6: 07 pop %es
b7: e9 db ff jmp 95 <test>
This strikes me as odd - according to the documentation:
@item
@code{ds} is a special case. Both @code{ds} and @code{ss} are assumed to
point to the program's data segment on entry, and @code{ds} should be
restored on exit. A function is free to modify @code{ds}, but it should
restore it to its initial value---perhaps via a @samp{pushw %ss; popw
%ds}---before calling another function, and before returning to its caller.
and so, if SS cannot be assumed to point to the program's data segment but DS can (on this platform, SS == the program's stack segment == 0x0000 and DS == the program's data segment == 0x1000), I would not expect the caller to be the party responsible for preserving the state of DS, but rather the callee - which does appear to be the case at least in the code I've examined.
I assume this is because DS can be used by the caller?
The text was updated successfully, but these errors were encountered:
Calls to three external functions in order:
with these compiler flags:
/opt/wonderful/toolchain/gcc-ia16-elf/bin/ia16-elf-gcc -std=gnu11 -Wall -march=v30mz -mtune=v30mz -mregparmcall -ffreestanding -mcmodel=small -mno-callee-assume-ss-data-segment -msegelf -mno-segment-relocation-stuff -fexec-charset=shift-jis -Iinclude -Ibuild/cbin -I/opt/wonderful/target/wwitch/include -ffunction-sections -fdata-sections -O2 -MMD -MP -c -o build/src/main.c.o src/main.c
, become the following machine code:This strikes me as odd - according to the documentation:
and so, if SS cannot be assumed to point to the program's data segment but DS can (on this platform, SS == the program's stack segment == 0x0000 and DS == the program's data segment == 0x1000), I would not expect the caller to be the party responsible for preserving the state of DS, but rather the callee - which does appear to be the case at least in the code I've examined.
I assume this is because DS can be used by the caller?
The text was updated successfully, but these errors were encountered: