Page 1 of 1

Genisoimage on OSX

Posted: Sat Feb 04, 2012 1:38 am
by zhiayang
So I just (attempted to) move development to osx (was running linux in VM before), and I'm stuck: How do I get the genisoimage command? I'm currently using GRUB eltorito for booting my kernel.

Also, I get this warning from gcc (cross compiler) which I didn't have in linux (non cross compiler)

Code: Select all

note: if this code is reached, the program will abort.
from this code:

Code: Select all

void kprintf(char str[], ...)
{
	va_list listptr;
	va_start(listptr, str);
	
	short is_percent = 0;
	
	register int i = 0;
	for(; i < strlen(str); i++)
	{
		if(str[i] == '%')
		{
			is_percent = 1;
			continue;
		}	
		if(is_percent)
		{
			switch(str[i])
			{
				case 'd':
					putnum(va_arg(listptr, int));
					break;
					
				case 'c':
					putch(va_arg(listptr, unsigned char));      //Faulty line, all others work.
					break;					
							
				case 'x':
					puthex(va_arg(listptr, unsigned int));
					break;		
					
				case 's':
					puts(va_arg(listptr, char*));
					break;
					
				case 'u':
					putunum(va_arg(listptr, unsigned long));
					break;
			}
			is_percent = 0;
		}		
		else
		{
			putch(str[i]);
		}
	}
}
Yes, I do have va_list etc defined, as such:

Code: Select all

#define va_start(v,l) __builtin_va_start(v,l)
#define va_arg(v,l)   __builtin_va_arg(v,l)
#define va_end(v)     __builtin_va_end(v)
#define va_copy(d,s)  __builtin_va_copy(d,s)
typedef __builtin_va_list va_list;
Halp?

Re: Genisoimage on OSX

Posted: Sat Feb 04, 2012 7:02 pm
by zhiayang
Great, thanks for that. But what about the other issue? I get an invalid opcode exception if I "kprintf(%c)"...



EDIT:::::
Did some tedious research, turns out that a 'char' is promoted to an int with va_arg. So there.

Re: Genisoimage on OSX

Posted: Sun Feb 05, 2012 6:59 am
by zhiayang
berkus wrote:That you could figure out with a bit of googling and even a thread on this forum.

Suffice to say that minimum increment of (E)SP is not 1.

requimrar wrote: tedious research
Tedious my @$$, 2 minutes googling is tedious nowadays?

Pardon me, perhaps 'tedious' was an over-exaggeration... :oops: