Jump to content

C++ proposition


Jief_Machak
 Share

823 posts in this topic

Recommended Posts

3 minutes ago, Jief_Machak said:

You just put back again the "AllocateZeroPool" for allocating objects !!!

Please don't : it CAN'T work for objects with virtual method. Of course it crashed.

Else memset is generated.

1 minute ago, Jief_Machak said:

Let me fix it and commit.

OK. But I want you to test the result.

Link to comment
Share on other sites

2 minutes ago, Jief_Machak said:

I was asking about the memset. Because at my last commit, it was compiling and running with GCC and CLang.

Running? I always have a hang at getLEGACY_ENTRY() or with getLOADER_ENTRY()

My doubts:

MainMenu.Entries[] allocated as REFIT_ABSTRACT_MENU_ENTRY with a sizeof(REFIT_ABSTRACT_MENU_ENTRY) even if operator new used.

But LEGACY_ENTRY is larger.

To make a superclass big enough there is a method to add empty slots to it.

Really I don't know what to do if not revert classes to structures.

If you can resolve it for gcc then I will not test with VS.

Link to comment
Share on other sites

It was working ! Entry are allocate with new. NO SIZEOF.

Wait a minute.

2 minutes ago, Slice said:

MainMenu.Entries[] allocated as REFIT_ABSTRACT_MENU_ENTRY with a sizeof(REFIT_ABSTRACT_MENU_ENTRY)

That is wrong. Must use new WITHOUT a sizeof parameter.

Link to comment
Share on other sites

I assume he means that he is allocating an array but it is not allocated properly? I think he means, the size of the allocation is only one REFIT_ABSTRACT_MENU_ENTRY instead of the size for count the array elements.

 

EDIT: In c++ a struct is a class where the scope is public by default, instead of private. Every class (and therefore every struct) is given a default no argument constructor, copy constructor, and assignment operator if they are not defined for the class.

Edited by apianti
Link to comment
Share on other sites

VS2017 seems to generate memset at new, as you said.

I tried to define default ctor. If there is a default ctor, zeroing object memory is not needed. But VS seesm to still generate it...

Providing an implementation for memset doesn't work if /GL is used for compilation.

So far, I just remove the /GL.

 

I didn't try to launch the efi made by VS...

Link to comment
Share on other sites

3 minutes ago, Jief_Machak said:

I didn't commit the removal of /GL. Should I ?

If it helps... I will check VS tomorrow. Now I am in Mojave with Xcode. Testing...

Link to comment
Share on other sites

Still not working

Снимок экрана 2020-03-04 в 20.04.30.png

debug.log finished at menu.run

28:417  0:001  Default boot entry not found
28:418  0:001  DefaultIndex=-1 and MainMenu.Entries.size()=8

I just wonder how can you say it works.

Link to comment
Share on other sites

1 minute ago, Jief_Machak said:

I have Legacy to true. But I guess no legacy boot. Must I make a MBR drive ?

I am testing in QEMU and I have MBR image.

Link to comment
Share on other sites

 Share

×
×
  • Create New...