Miller, Shao
2010-Jun-12 15:12 UTC
[syslinux] [PATCH] ifcpuXX: Support multiple parameters with labels
Even though Doug's out of the office, I'm submitting a patch to the ifcpu[|64].c32 COMBOOT32 modules for testing. Also available for perusal with a web browser at: http://git.zytor.com/?p=users/sha0/syslinux.git;a=commitdiff;h=cc70d0fa5 5e35fabf250f4dccbaed2fa44f56da7 - Shao Miller --->From cc70d0fa55e35fabf250f4dccbaed2fa44f56da7 Mon Sep 17 00:00:00 2001From: Shao Miller <sha0 at terminus.zytor.com> Date: Sat, 12 Jun 2010 08:03:28 -0700 Subject: [PATCH] ifcpuXX: Support multiple parameters with labels The ifcpu.c32 and ifcpu64.c32 modules take arguments including the form <true_label> -- <false_label>. It is convenient to allow these labels to be not just a single word, but to include parameters. This is useful for <TAB>-editing and modifying the command-line to include parameters you'd like to pass. Not-yet-tested: Shao Miller <shao.miller at yrdsb.edu.on.ca> --- com32/modules/ifcpu.c | 9 ++++++--- com32/modules/ifcpu64.c | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/com32/modules/ifcpu.c b/com32/modules/ifcpu.c index 8a9a5f4..1e57f08 100644 --- a/com32/modules/ifcpu.c +++ b/com32/modules/ifcpu.c @@ -71,20 +71,23 @@ static unsigned char sleep(unsigned int msec) /* XXX: this really should be librarized */ static void boot_args(char **args) { - int len = 0; + int len = 0, a = 0; char **pp; const char *p; char c, *q, *str; for (pp = args; *pp; pp++) - len += strlen(*pp); + len += strlen(*pp) + 1; - q = str = alloca(len + 1); + q = str = alloca(len); for (pp = args; *pp; pp++) { p = *pp; while ((c = *p++)) *q++ = c; + *q++ = ' '; + a = 1; } + q -= a; *q = '\0'; if (!str[0]) diff --git a/com32/modules/ifcpu64.c b/com32/modules/ifcpu64.c index 6d566a2..e123922 100644 --- a/com32/modules/ifcpu64.c +++ b/com32/modules/ifcpu64.c @@ -73,20 +73,23 @@ static bool __constfunc cpu_has_feature(int x) /* XXX: this really should be librarized */ static void boot_args(char **args) { - int len = 0; + int len = 0, a = 0; char **pp; const char *p; char c, *q, *str; for (pp = args; *pp; pp++) - len += strlen(*pp); + len += strlen(*pp) + 1; - q = str = alloca(len + 1); + q = str = alloca(len); for (pp = args; *pp; pp++) { p = *pp; while ((c = *p++)) *q++ = c; + *q++ = ' '; + a = 1; } + q -= a; *q = '\0'; if (!str[0]) -- 1.7.0.1 -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-ifcpuXX-Support-multiple-parameters-with-labels.patch Type: application/octet-stream Size: 2152 bytes Desc: 0001-ifcpuXX-Support-multiple-parameters-with-labels.patch URL: <http://www.zytor.com/pipermail/syslinux/attachments/20100612/62e84e71/attachment.obj>
Gert Hulselmans
2010-Jun-13 00:27 UTC
[syslinux] [PATCH] ifcpuXX: Support multiple parameters with labels
Miller, Shao wrote:> Even though Doug's out of the office, I'm submitting a patch to the > ifcpu[|64].c32 COMBOOT32 modules for testing. Also available for > perusal with a web browser at: > > > > http://git.zytor.com/?p=users/sha0/syslinux.git;a=commitdiff;h=cc70d0fa5 > 5e35fabf250f4dccbaed2fa44f56da7 > > > > - Shao Miller >I tested it, and it supported commands with spaces. The same code is used in ifplop.c32 (COM32 which detects if PLoP INT13 hook is installed, and which will be published in another mail). ifcpu.c32 only did want to boot the last label on my PC. ifcpu.c32 64 label_64 -- label_32 cpuidtest.c32 doesn't show all flags (only a very small subset, which might explain why I never could boot the label_64. $ cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 15 model : 107 model name : AMD Athlon(tm) 64 X2 Dual Core Processor 5000+ stepping : 1 cpu MHz : 1000.000 cache size : 512 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow extd_apicid pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy 3dnowprefetch bogomips : 1999.86 clflush size : 64 power management: ts fid vid ttp tm stc 100mhzsteps processor : 1 vendor_id : AuthenticAMD cpu family : 15 model : 107 model name : AMD Athlon(tm) 64 X2 Dual Core Processor 5000+ stepping : 1 cpu MHz : 1000.000 cache size : 512 KB physical id : 0 siblings : 2 core id : 1 cpu cores : 2 apicid : 1 initial apicid : 1 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow extd_apicid pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy 3dnowprefetch bogomips : 1999.86 clflush size : 64 power management: ts fid vid ttp tm stc 100mhzsteps - Gert Hulselmans
Reasonably Related Threads
- whichsys.c32: execute specific command, based on Syslinux bootloader variant
- [PATCH] ifplop.c32: Detect if PLoP USB/CD INT13h hook is enabled/disabled
- [PATCH] ifmemdsk.c32: Allow boot options based on presence of MEMDISK
- [PATCH] ifgpxe.c32
- [PATCH]: ifplop.c32: COM32 module for detection of PLoP USB boot-loader