TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: PAUL WANKADIA
from: JAMES VAHN
date: 1997-07-06 17:35:00
subject: Re: FW: protected mode

> > Here's my latest revision of the code :
> > /*
> >         boot/setup.S
> >         ~~~~~~~~~~~~
> 
> $ gcc -E setup.S -o setup.s
> $ as setup.s -o setup
> $ strip setup
> $ ls -l setup
>   -rw-r--r--   1 jvahn    jvahn         488 Jul  5 19:41 setup
I see now, we need to link these things just like always:
        gcc -E setup.S -o setup.s
        as setup.s -o setup.o
        ld -e main -oformat binary -o setup setup.o 
Much better, but there were some changes needed before it would assemble.
.code16
.text
.global main                            /* main, not start */
main :
[....]
        movw    msg, %bp                /* was $msg */
        movw    msg_length, %cx  
        int     $0x10
Using $msg, the linker (ld) complained:
 setup.o(.text+0x18): relocation truncated to fit: R_386_16 text
But what has it done?  This is a TASM-like dump from ndisasm,
none of the indirect addresses look right:
00000011  B80113            mov ax,0x1301
00000014  BB0700            mov bx,0x7
00000017  678B2D72800408    mov bp,[dword 0x8048072]
0000001E  678B0D8E800408    mov cx,[dword 0x804808e]
00000025  CD10              int 0x10
00000027  FA                cli
00000028  B080              mov al,0x80
0000002A  E670              out 0x70,al
0000002C  670F01154E800408  lgdt [dword 0x804804e]
00000034  670F011D6C800408  lidt [dword 0x804806c]
0000003C  660F20C0          o32 mov eax,cr0
00000040  0C01              or al,0x1
00000042  660F22C0          o32 mov cr0,eax
00000046  66EA001000000800  jmp dword 0x8:0x1000
Apparently labels are considered to be in 32 bit segments despite
the .code16 directive. And where is that jumping to?
 
--- ifmail-tx (i386 Linux)
---------------
* Origin: James Vahn (jvahn@short.circuit.com) (1:346/15.1)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.