tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] principle issues with x86 16bit real-mode assembly


From: Michael Ackermann
Subject: [Tinycc-devel] principle issues with x86 16bit real-mode assembly
Date: Mon, 25 Nov 2024 02:02:20 +0000

A few notes should be summarized:
- .code16 sections and 16bit real-mode support are mostly abandoned with tcc
- release-tag release_0_9_25 retained 16bit real-mode asm support iirc
- release_0_9_26 already had deactived it with #ifdefs
- finally https://repo.or.cz/tinycc.git/commitdiff/55bd08c5 removed it

With consequences to critical system components such as:
- x86 kernel and loaders including tccboot itself rely upon 16bit real-mode asm
- real-mode asm may be crucial to "kernel bootstrapping" that 
   bootstrappable.org considers unresolved
- interestingly, earlier kernel versions (2.2 iirc) implemented their 16bit
  real-mode asm bootcode parts with another syntax than GNU gas one
- binutils-as introduce a gigantic dependency graph

Testing release_0_9_25 confirmed various assembly components of linux-2.4.37
containing .code16 could not be processed with tcc assembler, therefore
reverting commit 55bd08c5 onto latest mob branch for testing was skipped.

i386-tcc preprocessor and assembler from latest HEAD choke .code16 sections
still, but cannot completely process it either to emit real-mode bootcode.
Latest x86_64-tcc assembler instead errors immediately on .code16 token spotted.

For CC=i386-tcc a few test-cases with linux-2.4.37.11 (i386) could be considered
regardless,since some of which may not be specific to 16bit and/or may be fixed,
and tccboot is using some of the related linux bootcode itself too:
1)
  $CC -nostdinc -nostdlib -D__BIG_KERNEL__ -I../linux/include \
    bootsect.S -o bootsect.o
  ### bootsect.S:108: error: register expected
  ### -> ldsw    %fs:(%bx), %si          # %ds:%si is source
2)
  $CC -E -P -I../linux/include -D__ASSEMBLY__ -D__KERNEL__ -D__BIG_KERNEL__ \
  setup.S -o setup.s
  ### preprocessing ok
  $CC -I../linux/include -D__ASSEMBLY__ -D__KERNEL__ -D__BIG_KERNEL__ \
    setup.s -o setup.o
  ### setup.s:20: error: constant expected
  ### -> .word   kernel_version
3)
  $CC -I../linux/include -D__ASSEMBLY__ -D__KERNEL__ -D__BIG_KERNEL__ \
  trampoline.S -o trampoline.o
  ### trampoline.S:61: error: unknown opcode 'ljmpl'
  ### -> ljmpl   $__KERNEL_CS, $0x00100000
### 
https://stackoverflow.com/questions/39323061/gnu-as-compilation-error-on-instruction-far-jmp-0x8-0x80000
### i386-tcc is not aware of ljmpl , and ljmp implies different adressing and 
sizes (16bit/32bit)

I do not see a realistic chance to salvage 16bit real-mode support with tinycc
myself; and FYI bootstrappable.org chose a different approach to implement x86
bootcode with their hex0 languages and loaders.

--
 

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]