[syslinux] Accessing command_line from core C code

Sebastian Herbszt herbszt at gmx.de
Fri Jul 16 02:37:55 PDT 2010


H. Peter Anvin wrote:
> On 07/15/2010 03:02 PM, Sebastian Herbszt wrote:
>> I tried to replace display_labels asm code (ui.inc) with new C code
>> (pm_display_labels),
>> but the data i access in command_line doesn't seem to be always up to date.
>> The patch i am working on is only for PXELINUX because of different
>> vkernel structure:
> 
> I would really like to get rid of the entire ui.inc (actually the rest
> of the assembly core, too) and have it replaced with C code... a lot of
> work in that direction has already happened of the "elflink" branch
> (Syslinux 5).  On the other hand, perhaps an incremental approach is
> useful, too.

I consider my code an exercise for me. Just wanted to figure out how to
access (read, create) the vkernel structure from C code.

> I think the part you're missing is that command_line is not guaranteed
> to be zero-terminated during editing.  The assembly code uses register
> DI to keep track of the end of the command line; it does zero-terminate
> the string when it is complete, however.
> 
> -hpa

The following change fixed it, thanks.

Sebastian

diff --git a/core/ui.inc b/core/ui.inc
index 3e28dac..c7617c1 100644
--- a/core/ui.inc
+++ b/core/ui.inc
@@ -151,6 +151,7 @@ display_labels:
                cmp word [NoComplete],0         ; Label completion enabled?
                jne get_char_2
                push di
+               mov byte [di],0                 ; Null-terminate command line
                pm_call pm_display_labels
                jmp fk_wrcmd




More information about the Syslinux mailing list